Compare commits

..

1 Commits

Author SHA1 Message Date
Zane Schepke f513297ba0 fix: file selection on older devices
Fixes bug where file selection was causing app to crash on older devices.
2023-08-11 21:13:54 -04:00
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ android {
val versionMajor = 2
val versionMinor = 3
val versionPatch = 4
val versionPatch = 5
val versionBuild = 0
defaultConfig {
@@ -144,7 +144,12 @@ class MainViewModel @Inject constructor(private val application : Application,
@SuppressLint("Range")
private fun getFileName(context: Context, uri: Uri): String {
if (uri.scheme == "content") {
val cursor = context.contentResolver.query(uri, null, null, null, null)
val cursor = try {
context.contentResolver.query(uri, null, null, null, null)
} catch (e : Exception) {
Timber.d("Exception getting config name")
null
}
cursor ?: return defaultConfigName()
cursor.use {
if(cursor.moveToFirst()) {