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 a collectionView.selectItem crash #360

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

dl10yr
Copy link
Contributor

@dl10yr dl10yr commented Mar 1, 2024

@mikaoj

I faced a crash at follows. ( Xcode15)

collectionView.selectItem(at: indexPath, animated: false, scrollPosition: [])

https://github.com/mikaoj/BSImagePicker/blob/master/Sources/Scene/Assets/AssetsViewController.swift#L115C13-L115C90

The error I faced is as follows.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempted to modify the selection of an out-of-bounds item (2) when there are only 0 items in section 0. Collection view:

I fixed this issue by adding guard.

Thank you for maintaining the very useful package!

@dl10yr dl10yr changed the title Fix a collectionView.selectItem crash issue Fix a collectionView.selectItem crash Mar 1, 2024
@mikaoj mikaoj self-requested a review March 6, 2024 07:27
@mikaoj
Copy link
Owner

mikaoj commented Mar 6, 2024

Thank you for maintaining the very useful package!

I haven't done very much maintenance for a long time now.
But thanks for contributing! :)

@mikaoj mikaoj merged commit 929717c into mikaoj:master Mar 6, 2024
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