add a couple null checks at multiselectors

This commit is contained in:
tibbi 2017-05-28 23:37:12 +02:00
parent a04d2d80b6
commit 124cf8960d
2 changed files with 3 additions and 3 deletions

View file

@ -145,7 +145,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
fun checkHideBtnVisibility(menu: Menu) {
var hiddenCnt = 0
var unhiddenCnt = 0
selectedPositions.map { dirs[it].path }.forEach {
selectedPositions.map { dirs.getOrNull(it)?.path }.filterNotNull().forEach {
if (File(it).containsNoMedia())
hiddenCnt++
else
@ -160,7 +160,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
val pinnedFolders = config.pinnedFolders
var pinnedCnt = 0
var unpinnedCnt = 0
selectedPositions.map { dirs[it].path }.forEach {
selectedPositions.map { dirs.getOrNull(it)?.path }.filterNotNull().forEach {
if (pinnedFolders.contains(it))
pinnedCnt++
else

View file

@ -140,7 +140,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
fun checkHideBtnVisibility(menu: Menu) {
var hiddenCnt = 0
var unhiddenCnt = 0
selectedPositions.map { media[it] }.forEach {
selectedPositions.map { media.getOrNull(it) }.filterNotNull().forEach {
if (it.name.startsWith('.'))
hiddenCnt++
else