فهرست منبع

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 }) {