add some IndexOutOfBoundsException checks at adapters

This commit is contained in:
tibbi 2018-05-13 21:30:24 +02:00
parent 50ee6d5abb
commit 6ca5191500
2 changed files with 2 additions and 2 deletions

View file

@ -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)
}

View file

@ -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)