add null checks at toggleItemSelection of adapters

This commit is contained in:
tibbi 2017-08-06 12:21:31 +02:00
parent 178c92c993
commit 7fa71c5302
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
fun toggleItemSelection(select: Boolean, pos: Int) {
if (select) {
itemViews[pos].dir_check.background.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
itemViews[pos]?.dir_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
selectedPositions.add(pos)
} else
selectedPositions.remove(pos)

View File

@ -37,7 +37,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
fun toggleItemSelection(select: Boolean, pos: Int) {
if (select) {
itemViews[pos].medium_check.background.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
itemViews[pos]?.medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
selectedPositions.add(pos)
} else
selectedPositions.remove(pos)