add bounds check

This commit is contained in:
Max Sokolov 2018-03-17 00:03:53 +03:00
parent 70d83fc5b0
commit a1e1e9d908
1 changed files with 9 additions and 6 deletions

View File

@ -102,12 +102,15 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
cell: UITableViewCell?, indexPath: IndexPath,
userInfo: [AnyHashable: Any]? = nil) -> Any?
{
return sections[indexPath.section].rows[indexPath.row].invoke(
action: action,
cell: cell,
path: indexPath,
userInfo: userInfo
)
if indexPath.section < sections.count && indexPath.row < sections[indexPath.section].rows.count {
return sections[indexPath.section].rows[indexPath.row].invoke(
action: action,
cell: cell,
path: indexPath,
userInfo: userInfo
)
}
return nil
}
open override func responds(to selector: Selector) -> Bool {