From af9f8f529beb1cd95c05e3e04a185f4ef408787b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 21 Feb 2020 22:22:55 +0530 Subject: [PATCH] UserPreference: Fix changes from 9787489bc5b7 Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 3 ++- 1 file changed, 2 insertions(+), 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 469e3773..50d5bcad 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt @@ -481,7 +481,8 @@ 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 repoPath = "${Environment.getExternalStorageDirectory()}/${split[1] ?: split[0]}" + val path = if (split.size > 0) split[1] else split[0] + val repoPath = "${Environment.getExternalStorageDirectory()}/$path" Timber.tag(TAG).d("Selected repository path is $repoPath")