Explorar o código

App Delegate: prevent crash if added media is being removed while it didn't fully arrive

Felix Paul Kühne %!s(int64=12) %!d(string=hai) anos
pai
achega
e6f59ee99a
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      AspenProject/VLCAppDelegate.m

+ 3 - 1
AspenProject/VLCAppDelegate.m

@@ -135,6 +135,9 @@
 
         NSNumber *prevFetchedSize = [_addedFiles objectForKey:fileURL];
         NSNumber *updatedSize = [attribs objectForKey:NSFileSize];
+        if (!updatedSize || updatedSize.intValue == 0)
+            continue;
+
         if ([prevFetchedSize compare:updatedSize] == NSOrderedSame) {
             [_addedFiles removeObjectForKey:fileURL];
             [[MLMediaLibrary sharedMediaLibrary] addFilePaths:@[fileURL]];
@@ -197,7 +200,6 @@
         _addMediaTimer = [NSTimer scheduledTimerWithTimeInterval:2. target:self
                                                         selector:@selector(addFileTimerFired)
                                                         userInfo:nil repeats:YES];
-
     }
 }