cwac-pager
cwac-pager copied to clipboard
NPE at getCount()
Hi thanks for the great lib. Sometimes there is a null pointer exception at the getCount() method. I don't understand why - so I added the stacktrace.
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference at com.commonsware.cwac.pager.v4.ArrayPagerAdapter.getCount(ArrayPagerAdapter.java:79) at android.support.v4.view.ViewPager.dataSetChanged(ViewPager.java:1047) at android.support.v4.view.ViewPager$PagerObserver.onChanged(ViewPager.java:3113) at android.support.v4.view.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:284) at com.commonsware.cwac.pager.v4.ArrayPagerAdapter.restoreState(ArrayPagerAdapter.java:182) at android.support.v4.view.ViewPager.onRestoreInstanceState(ViewPager.java:1481) at android.view.View.dispatchRestoreInstanceState(View.java:14856)
The only way that could happen is if the saved instance state Bundle does not contain the array of PageDescriptor objects, yet we are restoring from that state. I have no idea how that could happen. If you are in position to create a reproducible test case for this, upload it and I can work on it.