mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
add some IndexOutOfBoundsException checks at adapters
This commit is contained in:
parent
50ee6d5abb
commit
6ca5191500
2 changed files with 2 additions and 2 deletions
|
@ -61,7 +61,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
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 ->
|
val view = holder.bindView(dir, !isPickIntent) { itemView, adapterPosition ->
|
||||||
setupView(itemView, dir)
|
setupView(itemView, dir)
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) {
|
||||||
val medium = media[position]
|
val medium = media.getOrNull(position) ?: return
|
||||||
visibleItemPaths.add(medium.path)
|
visibleItemPaths.add(medium.path)
|
||||||
val view = holder.bindView(medium, !allowMultiplePicks) { itemView, adapterPosition ->
|
val view = holder.bindView(medium, !allowMultiplePicks) { itemView, adapterPosition ->
|
||||||
setupView(itemView, medium)
|
setupView(itemView, medium)
|
||||||
|
|
Loading…
Reference in a new issue