소스 검색

Fix runtime exception

(cherry picked from commit 3faa83ce8f6df26725259878a75748782fa6da27)
Felix Paul Kühne 9 년 전
부모
커밋
dac4d8dc1d
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      Apple-TV/Playback/Playback Info/VLCPlaybackInfoChaptersTVViewController.m

+ 6 - 3
Apple-TV/Playback/Playback Info/VLCPlaybackInfoChaptersTVViewController.m

@@ -138,9 +138,12 @@
     BOOL isSelected = player.currentChapterIndex == row;
     trackCell.selectionMarkerVisible = isSelected;
 
-    NSDictionary *description = [player chapterDescriptionsOfTitle:player.currentTitleIndex][row];
-    NSString *chapterTitle = [NSString stringWithFormat:@"%@ (%@)", description[VLCChapterDescriptionName], [[VLCTime timeWithNumber:description[VLCChapterDescriptionDuration]] stringValue]];
-    trackCell.titleLabel.text = chapterTitle;
+    NSArray *chapterDescriptions = [player chapterDescriptionsOfTitle:player.currentTitleIndex];
+    if (row < chapterDescriptions.count) {
+        NSDictionary *description = chapterDescriptions[row];
+        NSString *chapterTitle = [NSString stringWithFormat:@"%@ (%@)", description[VLCChapterDescriptionName], [[VLCTime timeWithNumber:description[VLCChapterDescriptionDuration]] stringValue]];
+        trackCell.titleLabel.text = chapterTitle;
+    }
 }
 
 -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath