Parcourir la source

fix 2 runtime exceptions

(cherry picked from commit 154031c795b2ce244a4d8ddb69b431734765047b)
Felix Paul Kühne il y a 10 ans
Parent
commit
b35d762650
2 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 3 0
      Sources/VLCPlaybackController.m
  2. 2 0
      Sources/VLCPlaylistViewController.m

+ 3 - 0
Sources/VLCPlaybackController.m

@@ -392,6 +392,9 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
         fileItem.lastAudioTrack = @(_mediaPlayer.currentAudioTrackIndex);
         fileItem.lastSubtitleTrack = @(_mediaPlayer.currentVideoSubTitleIndex);
 
+        if ([fileItem isKindOfType:kMLFileTypeAudio])
+            return;
+
         if (position > .95)
             return;
 

+ 2 - 0
Sources/VLCPlaylistViewController.m

@@ -388,6 +388,8 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
     NSString *folderLocation = [[mediaObject.url path] stringByDeletingLastPathComponent];
     NSArray *allfiles = [fileManager contentsOfDirectoryAtPath:folderLocation error:nil];
     NSString *fileName = [mediaObject.path.lastPathComponent stringByDeletingPathExtension];
+    if (!fileName)
+        return;
     NSIndexSet *indexSet = [allfiles indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
        return ([obj rangeOfString:fileName].location != NSNotFound);
     }];