Fix for Crash issue when no message #61

This commit is contained in:
Andrew Lauder
2017-08-16 10:56:14 -07:00
parent 7e28572e19
commit ea5af9cff6
+1 -1
View File
@@ -37,7 +37,7 @@ open class MessagesCollectionView: UICollectionView {
private var indexPathForLastItem: IndexPath? {
let lastSection = numberOfSections > 0 ? numberOfSections - 1 : 0
guard numberOfItems(inSection: lastSection) > 0 else { return nil }
guard lastSection > 0, numberOfItems(inSection: lastSection) > 0 else { return nil }
return IndexPath(item: numberOfItems(inSection: lastSection) - 1, section: lastSection)
}