Commit 5454d158 authored by Mygod's avatar Mygod

Skip nonexisting view holders

parent 482e94aa
......@@ -111,8 +111,8 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
return if (flipper) first++ else last--
}
}.asSequence().toList().reversed()) {
val viewHolder = profilesList.findViewHolderForAdapterPosition(i) as ProfileViewHolder
if (viewHolder.item.isSponsored) {
val viewHolder = profilesList.findViewHolderForAdapterPosition(i) as? ProfileViewHolder
if (viewHolder?.item?.isSponsored == true) {
viewHolder.populateUnifiedNativeAdView(nativeAd!!, nativeAdView!!)
// might be in the middle of a layout after scrolling, need to wait
withContext(Dispatchers.Main) { profilesAdapter.notifyItemChanged(i) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment