Guard against negative numbers. Fixes #3768

This commit is contained in:
Maurice Parker
2022-12-02 20:53:10 -06:00
parent 1c4b0c486a
commit 209d4483c6

View File

@@ -636,7 +636,10 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
}
func nodeFor(_ indexPath: IndexPath) -> Node? {
guard indexPath.section < shadowTable.count && indexPath.row < shadowTable[indexPath.section].feedNodes.count else {
guard indexPath.section > -1 &&
indexPath.row > -1 &&
indexPath.section < shadowTable.count &&
indexPath.row < shadowTable[indexPath.section].feedNodes.count else {
return nil
}
return shadowTable[indexPath.section].feedNodes[indexPath.row].node