fix: guard destroyItem against null entries in ViewPager mItems
Phillip Davis
created
`null` was to `ConversationPage` in `destroyItem` when
`ViewPager.dataSetChanged`'s POSITION_NONE branch cleaned up a dormant
null in `mItems`. The null originates from `instantiateItem`'s
bounds-check branch (`position-2 >= sessions.size() -> return null`),
which ViewPager stores via `addNewItem` and later passes back to
`destroyItem` during cleanup.
Deterministically tested fix by the first call to `instantiateItem`
should return `null`, after which a `notifyDataSetChanged` via
tapping another command. Resulted in same crash as the report.
@@ -2059,6 +2059,7 @@ public class Conversation extends AbstractEntity
@Override
public void destroyItem(@NonNull ViewGroup container, int position, Object o) {
+ if (o == null) return;
if (position < 2) {
container.removeView((View) o);
return;