From 2c6d4548c5a163ff17f4c0d1cebaf65c467c1ba4 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 20 Jun 2020 12:19:55 +0530 Subject: [PATCH] UserPreference: fix my inability to count (#863) --- app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt index cd01c883..0ed1a66a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt @@ -676,7 +676,7 @@ class UserPreference : AppCompatActivity() { // TODO: This is fragile. Workaround until PasswordItem is backed by DocumentFile val docId = DocumentsContract.getTreeDocumentId(uri) val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - val path = if (split.isNotEmpty()) split[1] else split[0] + val path = if (split.size > 1) split[1] else split[0] val repoPath = "${Environment.getExternalStorageDirectory()}/$path" val prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext)