Procházet zdrojové kódy

media player: add missing sanity check

Felix Paul Kühne před 5 roky
rodič
revize
408eddbadf
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      Sources/VLCMediaPlayer.m

+ 4 - 1
Sources/VLCMediaPlayer.m

@@ -799,7 +799,10 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
 
 - (int)numberOfChaptersForTitle:(int)titleIndex
 {
-    return libvlc_media_player_get_chapter_count_for_title(_playerInstance, titleIndex);
+    if (titleIndex >= 0) {
+        return libvlc_media_player_get_chapter_count_for_title(_playerInstance, titleIndex);
+    }
+    return 0;
 }
 
 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex