瀏覽代碼

EditController: Delete: Add safety guard for empty selection

Soomin Lee 5 年之前
父節點
當前提交
963145df35
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Sources/EditController.swift

+ 5 - 0
Sources/EditController.swift

@@ -167,6 +167,11 @@ extension EditController: EditToolbarDelegate {
     }
 
     func editToolbarDidDelete(_ editToolbar: EditToolbar) {
+        guard !selectedCellIndexPaths.isEmpty else {
+            assertionFailure("EditController: Delete called without selection")
+            return
+        }
+
         var objectsToDelete = [VLCMLObject]()
 
         for indexPath in selectedCellIndexPaths.sorted(by: { $0 > $1 }) {