Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash during device rotation #218

Merged
merged 1 commit into from
Apr 8, 2016
Merged

Conversation

Sega-Zero
Copy link
Contributor

In some rare cases, UICollectionView may throw an exception while items reloading (see http://stackoverflow.com/questions/13929518/ for example).
The crash occurs when items size does not fit into CollectionView’s contentSize + offsets or having negative width/height. One possible reason of it is the case when (during a rotation) view.bound.size returns a very small size.
This fix trying to catch that case and ignore all the rest code.

Couldn't reproduce that behavior on a clean project, but that crash occurs pretty frequently on 6+ devices in one of my production projects. It looks like this:
ctassetsgridviewcontroller m edited 2016-03-25 01-43-46

In some rare cases, UICollectionView may throw an exception while items
reloading (http://stackoverflow.com/questions/13929518/).
The crash occurs when items size does not fit into CollectionView’s
contentSize + offsets. One possible reason of it is the case when
(during a rotation) view.bound.size returns a very small rect.
This fix trying to catch that case and ignore all the rest code.
@1and2papa
Copy link
Owner

@Sega-Zero This PR will be merged as pre-release too. Thanks.

@1and2papa 1and2papa merged commit a90eda4 into 1and2papa:master Apr 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants