UserPreference: fix my inability to count (#863)

This commit is contained in:
Harsh Shandilya 2020-06-20 12:19:55 +05:30 committed by GitHub
parent 585d59859d
commit 2c6d4548c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)