UserPreference: Fix changes from 9787489bc5

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-02-21 22:22:55 +05:30
parent 812b92ab38
commit af9f8f529b

View file

@ -481,7 +481,8 @@ class UserPreference : AppCompatActivity() {
// TODO: This is fragile. Workaround until PasswordItem is backed by DocumentFile // TODO: This is fragile. Workaround until PasswordItem is backed by DocumentFile
val docId = DocumentsContract.getTreeDocumentId(uri) val docId = DocumentsContract.getTreeDocumentId(uri)
val split = docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() 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") Timber.tag(TAG).d("Selected repository path is $repoPath")