add some null checks to deselecting items

This commit is contained in:
tibbi 2017-05-19 20:30:35 +02:00
parent e086ac134f
commit 9e788d9453
2 changed files with 4 additions and 2 deletions

View file

@ -135,7 +135,8 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
override fun onDestroyActionMode(actionMode: ActionMode?) { override fun onDestroyActionMode(actionMode: ActionMode?) {
super.onDestroyActionMode(actionMode) super.onDestroyActionMode(actionMode)
selectedPositions.forEach { selectedPositions.forEach {
getProperView(itemViews[it]!!).isSelected = false if (itemViews[it] != null)
getProperView(itemViews[it]!!).isSelected = false
} }
selectedPositions.clear() selectedPositions.clear()
actMode = null actMode = null

View file

@ -130,7 +130,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
override fun onDestroyActionMode(actionMode: ActionMode?) { override fun onDestroyActionMode(actionMode: ActionMode?) {
super.onDestroyActionMode(actionMode) super.onDestroyActionMode(actionMode)
selectedPositions.forEach { selectedPositions.forEach {
getProperView(itemViews[it]!!).isSelected = false if (itemViews[it] != null)
getProperView(itemViews[it]!!).isSelected = false
} }
selectedPositions.clear() selectedPositions.clear()
actMode = null actMode = null