Преглед на файлове

Fix runtime exception

(cherry picked from commit b5412fceb5e4672c1cf319d8dccd259a8db713b3)
Felix Paul Kühne преди 9 години
родител
ревизия
6acc8dde7f
променени са 1 файла, в които са добавени 5 реда и са изтрити 2 реда
  1. 5 2
      Sources/VLCLibraryViewController.m

+ 5 - 2
Sources/VLCLibraryViewController.m

@@ -681,8 +681,11 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
 
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    if (editingStyle == UITableViewCellEditingStyleDelete)
-        [self removeMediaObject: _foundMedia[indexPath.row] updateDatabase:YES];
+    if (editingStyle == UITableViewCellEditingStyleDelete) {
+        NSInteger row = indexPath.row;
+        if (row < _foundMedia.count)
+            [self removeMediaObject: _foundMedia[row] updateDatabase:YES];
+    }
 }
 
 - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath