diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 759f35730..e1faec46d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -61,7 +61,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList setupView(itemView, dir) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 41a55951c..731a02623 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -64,7 +64,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) { - val medium = media[position] + val medium = media.getOrNull(position) ?: return visibleItemPaths.add(medium.path) val view = holder.bindView(medium, !allowMultiplePicks) { itemView, adapterPosition -> setupView(itemView, medium)