Fixed ArrayIndexOutOFBoundsException

This commit is contained in:
Pupil
2020-02-17 18:50:58 +09:00
parent 1dbfc64f37
commit 66fb2e9a62
2 changed files with 8 additions and 4 deletions

View File

@@ -115,7 +115,10 @@ class DownloadLocationDialog(val activity: Activity) : AlertDialog(activity) {
externalFilesDirs.indexOfFirst {
it.canonicalPath == getDownloadDirectory(context).canonicalPath
}.let { index ->
buttons[index].first.isChecked = true
if (index < 0)
buttons.first().first.isChecked = true
else
buttons[index].first.isChecked = true
}
setTitle(R.string.settings_dl_location)