فهرست منبع

media player: add missing sanity check

Felix Paul Kühne 5 سال پیش
والد
کامیت
408eddbadf
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  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