Fix crash (IllegalStateException) observed on PlayStore

This commit is contained in:
Benoit Marty 2019-08-07 13:24:43 +02:00
parent 12a0cbb400
commit 3584658c36

View File

@ -35,9 +35,9 @@ fun getFilenameFromUri(context: Context?, uri: Uri): String? {
}
if (result == null) {
result = uri.path
val cut = result.lastIndexOf('/')
val cut = result?.lastIndexOf('/') ?: -1
if (cut != -1) {
result = result.substring(cut + 1)
result = result?.substring(cut + 1)
}
}
return result