mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-17 22:08:00 +01:00
catch exceptions thrown at getting mimetype from uri
This commit is contained in:
parent
70afd655ae
commit
de1c418f78
1 changed files with 4 additions and 1 deletions
|
@ -82,7 +82,10 @@ fun Context.getSortedDirectories(source: ArrayList<Directory>): ArrayList<Direct
|
||||||
fun Context.getMimeTypeFromUri(uri: Uri): String {
|
fun Context.getMimeTypeFromUri(uri: Uri): String {
|
||||||
var mimetype = uri.path.getMimeTypeFromPath()
|
var mimetype = uri.path.getMimeTypeFromPath()
|
||||||
if (mimetype.isEmpty()) {
|
if (mimetype.isEmpty()) {
|
||||||
mimetype = contentResolver.getType(uri)
|
try {
|
||||||
|
mimetype = contentResolver.getType(uri)
|
||||||
|
} catch (e: IllegalStateException) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return mimetype
|
return mimetype
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue