Skip to content

Commit

Permalink
Check if indexpath if nil
Browse files Browse the repository at this point in the history
  • Loading branch information
sergdort committed Nov 9, 2018
1 parent 07f73ec commit 58180af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Bento/Adapters/CollectionViewAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ open class CollectionViewAdapterBase<SectionID: Hashable, ItemID: Hashable>
}

@objc(collectionView:canPerformAction:forItemAtIndexPath:withSender:)
open func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
guard let component = sections[indexPath.section].items[indexPath.row].component(as: MenuItemsResponding.self) else {
open func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath?, withSender sender: Any?) -> Bool {
guard let indexPath = indexPath,
let component = sections[indexPath.section].items[indexPath.row].component(as: MenuItemsResponding.self) else {
return false
}

Expand Down

0 comments on commit 58180af

Please sign in to comment.