mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
null checking scheme in getLocalFilePathByUri
This commit is contained in:
parent
b0b9664cef
commit
28c3318f93
@ -93,7 +93,6 @@ object FileUtils {
|
||||
context: Context,
|
||||
uri: Uri
|
||||
): String? {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
||||
DocumentsContract.isDocumentUri(context, uri)
|
||||
) {
|
||||
@ -110,11 +109,16 @@ object FileUtils {
|
||||
} catch (ignore: IllegalArgumentException) {
|
||||
null
|
||||
}
|
||||
} else if ("content".equals(uri.scheme!!, ignoreCase = true)) {
|
||||
return contentQuery(context, uri)
|
||||
} else if ("file".equals(uri.scheme!!, ignoreCase = true)) {
|
||||
} else if (uri.scheme != null) {
|
||||
if ("content".equals(uri.scheme!!, ignoreCase = true)) {
|
||||
return contentQuery(context, uri)
|
||||
} else if ("file".equals(uri.scheme!!, ignoreCase = true)) {
|
||||
return uri.path
|
||||
}
|
||||
} else {
|
||||
return uri.path
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user