fix a crash at getting selected media

This commit is contained in:
tibbi 2018-07-01 11:40:42 +02:00
parent ee1ec98df9
commit b05919f7ec

View file

@ -331,7 +331,9 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
private fun getSelectedMedia(): List<Medium> { private fun getSelectedMedia(): List<Medium> {
val selectedMedia = ArrayList<Medium>(selectedPositions.size) val selectedMedia = ArrayList<Medium>(selectedPositions.size)
selectedPositions.forEach { selectedPositions.forEach {
selectedMedia.add(media[it] as Medium) (media.getOrNull(it) as? Medium)?.apply {
selectedMedia.add(this)
}
} }
return selectedMedia return selectedMedia
} }