summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-06-20 12:19:55 +0530
committerGitHub <noreply@github.com>2020-06-20 12:19:55 +0530
commit2c6d4548c5a163ff17f4c0d1cebaf65c467c1ba4 (patch)
tree07877aecbe15e49845abac6ce96414e5b1c04937
parent585d59859dd92a794baec46873ee8368a1bf23b7 (diff)
UserPreference: fix my inability to count (#863)
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.kt2
1 files changed, 1 insertions, 1 deletions
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)