Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Fix crash when switch the data source #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gshe
Copy link

@gshe gshe commented Feb 19, 2016

crash (100%) steps:

  1. set the ViewPagerController’s data source, total count is 10;
  2. select the active page as 9;
  3. i want to change the data source to another data source, total count maybe
    is 5. So i call ViewPagerController reloadData.
  4. ViewPagerController crash, out of range exception

Root Cause is self.activeContentIndex is still 9, NSArray cash when
call [self.contents replaceObjectAtIndex:index withObject:[NSNull null]]

crash steps:
1. set the ViewPagerController’s data source, total count is 10;
2. select the active page as 9;
3, i want to change the data source to another pages, total count maybe
is 5. So i call ViewPagerController reloadData.
4. ViewPagerController crash

Root Cause is self.activeContentIndex is still 9,  NSArray cash when
call [self.contents replaceObjectAtIndex:index withObject:[NSNull null]]
@pplant
Copy link

pplant commented Apr 28, 2016

Tried it on my fork and works like a charm! should be merged as soon as possible

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants