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

Fix crash when switch the data source#138

Open
gshe wants to merge 1 commit into
iltercengiz:masterfrom
gshe:master
Open

Fix crash when switch the data source#138
gshe wants to merge 1 commit into
iltercengiz:masterfrom
gshe:master

Conversation

@gshe

@gshe gshe commented Feb 19, 2016

Copy link
Copy Markdown

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

pplant commented Apr 28, 2016

Copy link
Copy Markdown

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