diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt index ccaca98d1..4d89b4be6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt @@ -62,7 +62,7 @@ class Utils { } } - fun getMimeType(url: String): String { + fun getMimeType(url: String): String? { val extension = MimeTypeMap.getFileExtensionFromUrl(url) return if (extension != null) { MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 7dab55c05..0dd8da69d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -250,7 +250,7 @@ class MainActivity : SimpleActivity(), GetDirectoriesAsynctask.GetDirectoriesLis val path = resultData.data.path val uri = Uri.fromFile(File(path)) if (mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent) { - val type = Utils.getMimeType(path) + val type = Utils.getMimeType(path) ?: "" setDataAndTypeAndNormalize(uri, type) flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION } else if (mIsPickImageIntent || mIsPickVideoIntent) {