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

Crash issue when no message #61

Closed
superdev89 opened this issue Aug 13, 2017 · 4 comments
Closed

Crash issue when no message #61

superdev89 opened this issue Aug 13, 2017 · 4 comments
Assignees
Milestone

Comments

@superdev89
Copy link

superdev89 commented Aug 13, 2017

The sample app crashes when you sent empty message list.

I debugged into the code and found the issue in MessagesCollectionView.swift.

var indexPathForLastItem: IndexPath? {

      let lastSection = numberOfSections > 0 ? numberOfSections - 1 : 0
      guard numberOfItems(inSection: lastSection) > 0 else { return nil }
      return IndexPath(item: numberOfItems(inSection: lastSection) - 1, section: lastSection)
}

if numberOfSections is 0, the lastSection should not exist and return nil, but here retrieving section 0.

@SD10 SD10 added this to the 0.5.0 milestone Aug 13, 2017
@SD10
Copy link
Member

SD10 commented Aug 13, 2017

@superdev89 Thank you for reporting this! 🎉
You can submit a PR to the v0.5.0 branch if you'd like to fix this yourself.

@MacMeDan
Copy link
Contributor

MacMeDan commented Aug 14, 2017

@superdev89 Let us know if you would like to fix it or we will open it up to anyone. Great job finding it. 💪😎👊 I am going to assign it to you for now.

@AndrewLauder
Copy link

I fixed this issue locally, should I open a PR?

@MacMeDan
Copy link
Contributor

That would be great @AndrewLauder.

SD10 added a commit that referenced this issue Aug 16, 2017
Fix for Crash issue when no message #61
@SD10 SD10 closed this as completed Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants