Avoid crash when receiving a nil indexPath (#248)

This commit is contained in:
Diego Sánchez 2016-11-06 19:38:12 +00:00 committed by GitHub
parent fa43ed65bb
commit 34a85527de
1 changed files with 4 additions and 1 deletions

View File

@ -89,7 +89,10 @@ extension BaseChatViewController: ChatCollectionViewLayoutDelegate {
}
@objc(collectionView:canPerformAction:forItemAtIndexPath:withSender:)
open func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
open func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath?, withSender sender: Any?) -> Bool {
// Note: IndexPath set optional due to https://github.com/badoo/Chatto/issues/247. SR-2417 might be related
// Might be related: https://bugs.swift.org/browse/SR-2417
guard let indexPath = indexPath else { return false }
return self.presenterForIndexPath(indexPath).canPerformMenuControllerAction(action)
}