From 0a757fcf9bfc80aa39ebdd5e1b33194a88f9dbcc Mon Sep 17 00:00:00 2001 From: Andrea Bellotto Date: Thu, 23 Jul 2020 16:42:06 +0200 Subject: [PATCH] Added check if exists row and section on didEndEditing. --- Sources/Owl/Table/TableDirector.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Owl/Table/TableDirector.swift b/Sources/Owl/Table/TableDirector.swift index 044dfa9..48d4ddd 100644 --- a/Sources/Owl/Table/TableDirector.swift +++ b/Sources/Owl/Table/TableDirector.swift @@ -678,6 +678,9 @@ extension TableDirector: UITableViewDataSource, UITableViewDelegate { public func tableView(_ tableView: UITableView, didEndEditingRowAt indexPath: IndexPath?) { guard let indexPath = indexPath else { return } + if indexPath.row >= tableView.numberOfRows(inSection: indexPath.section) { + return + } let (model, adapter) = context(forItemAt: indexPath) adapter.dispatchEvent(.didEndEdit, model: model, cell: nil, path: indexPath, params: nil) }