Browse Source

Fix runtime exception

(cherry picked from commit 3faa83ce8f6df26725259878a75748782fa6da27)
Felix Paul Kühne 9 years ago
parent
commit
dac4d8dc1d

+ 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