Quellcode durchsuchen

Prevent runtime exception

Felix Paul Kühne vor 10 Jahren
Ursprung
Commit
b7b5049b3d
1 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 6 4
      Sources/VLCBoxController.m

+ 6 - 4
Sources/VLCBoxController.m

@@ -110,12 +110,14 @@
 
 - (void)downloadFileToDocumentFolder:(BoxItem *)file
 {
-    if ([file.type isEqualToString:BoxAPIItemTypeFolder]) return;
+    if (file != nil) {
+        if ([file.type isEqualToString:BoxAPIItemTypeFolder]) return;
 
-    if (!_listOfBoxFilesToDownload)
-        _listOfBoxFilesToDownload = [NSMutableArray new];
+        if (!_listOfBoxFilesToDownload)
+            _listOfBoxFilesToDownload = [NSMutableArray new];
 
-    [_listOfBoxFilesToDownload addObject:file];
+        [_listOfBoxFilesToDownload addObject:file];
+    }
 
     if ([self.delegate respondsToSelector:@selector(numberOfFilesWaitingToBeDownloadedChanged)])
         [self.delegate numberOfFilesWaitingToBeDownloadedChanged];