mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
add some IndexOutOfBoundsException checks at adapters
This commit is contained in:
@@ -61,7 +61,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||
val dir = dirs[position]
|
||||
val dir = dirs.getOrNull(position) ?: return
|
||||
val view = holder.bindView(dir, !isPickIntent) { itemView, adapterPosition ->
|
||||
setupView(itemView, dir)
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||
}
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user