Explorar el Código

Fix runtime exception

(cherry picked from commit 972e48c7784c825e17ac2732d310d0b5954f9d92)
Felix Paul Kühne hace 9 años
padre
commit
87d4de50c1
Se han modificado 1 ficheros con 9 adiciones y 6 borrados
  1. 9 6
      Sources/VLCGoogleDriveTableViewController.m

+ 9 - 6
Sources/VLCGoogleDriveTableViewController.m

@@ -105,12 +105,15 @@
     if (cell == nil)
         cell = [VLCCloudStorageTableViewCell cellWithReuseIdentifier:CellIdentifier];
 
-    cell.driveFile = _googleDriveController.currentListFiles[indexPath.row];
-    if ([cell.driveFile.mimeType isEqualToString:@"application/vnd.google-apps.folder"])
-        [cell setIsDownloadable:NO];
-    else
-        [cell setIsDownloadable:YES];
-
+    NSArray *listOfFiles = _googleDriveController.currentListFiles;
+    NSInteger row = indexPath.row;
+    if (row < listOfFiles.count) {
+        cell.driveFile = listOfFiles[row];
+        if ([cell.driveFile.mimeType isEqualToString:@"application/vnd.google-apps.folder"])
+            [cell setIsDownloadable:NO];
+        else
+            [cell setIsDownloadable:YES];
+    }
     cell.delegate = self;
 
     return cell;