alibaba / UltraViewPager

UltraViewPager is an extension for ViewPager to provide multiple features in a single ViewPager.
MIT License
5k stars 678 forks source link

Calls PagerAdapters destroyItem method with a null parameter. #118

Open Fabrik19 opened 5 years ago

Fabrik19 commented 5 years ago

This view pager is very hard to use while writing the PagerAdapter in Kotlin. The third parameter of the destroyItem method has a @NonNull annotation. As Kotlin translates this to a non nullable parameter and checks this non nullability at runtime the app crashes when null is provided to this method. Sadly the UltraViewPager uses this part of code:

            View child = ((RelativeLayout) object).getChildAt(0);
            ((RelativeLayout) object).removeAllViews();
            adapter.destroyItem(container, realPosition, child);

If the RelativeLayout has no children null is provided to the destroyItem method.