Browse Source

Fix runtime exception

(cherry picked from commit 88c0879e6f97ad37a6782f74828081e461e92079)
Felix Paul Kühne 9 years ago
parent
commit
bb772be01a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Sources/VLCOneDriveTableViewController.m

+ 5 - 1
Sources/VLCOneDriveTableViewController.m

@@ -97,8 +97,12 @@
 
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
 {
-    VLCOneDriveObject *selectedObject = _oneDriveController.currentFolder.items[indexPath.row];
+    NSArray *folderItems = _oneDriveController.currentFolder.items;
+    NSInteger row = indexPath.row;
+    if (row >= folderItems.count)
+        return;
 
 
+    VLCOneDriveObject *selectedObject = folderItems[row];
     if (selectedObject.isFolder) {
     if (selectedObject.isFolder) {
         /* dive into sub folder */
         /* dive into sub folder */
         [self.activityIndicator startAnimating];
         [self.activityIndicator startAnimating];