Explorar o código

Prevent runtime exception

Felix Paul Kühne %!s(int64=10) %!d(string=hai) anos
pai
achega
ed5576f8ad
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      Sources/VLCGoogleDriveTableViewController.m

+ 5 - 1
Sources/VLCGoogleDriveTableViewController.m

@@ -120,6 +120,11 @@
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
+    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
+
+    if (indexPath.row >= _googleDriveController.currentListFiles.count)
+        return;
+
     _selectedFile = _googleDriveController.currentListFiles[indexPath.row];
     if (![_selectedFile.mimeType isEqualToString:@"application/vnd.google-apps.folder"]) {
         [_googleDriveController streamFile:_selectedFile];
@@ -130,7 +135,6 @@
         self.currentPath = [self.currentPath stringByAppendingString:_selectedFile.identifier];
         [self _requestInformationForCurrentPath];
     }
-    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
 }
 
 - (void)triggerDownloadForCell:(VLCCloudStorageTableViewCell *)cell