浏览代码

Fix runtime exception

(cherry picked from commit 9630628b89e25ab51d32768ec0dfea8b8d27ec42)
Felix Paul Kühne 9 年之前
父节点
当前提交
4ce15271d6
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Apple-TV/Playback/Playback Info/VLCPlaybackInfoTracksTVViewController.m

+ 5 - 1
Apple-TV/Playback/Playback Info/VLCPlaybackInfoTracksTVViewController.m

@@ -104,7 +104,11 @@
 {
     VLCPlaybackInfoTVCollectionViewCell *trackCell = (VLCPlaybackInfoTVCollectionViewCell*)cell;
     NSInteger row = indexPath.row;
-    BOOL isSelected = [self.mediaPlayer.audioTrackIndexes[row] intValue] == self.mediaPlayer.currentAudioTrackIndex;
+    BOOL isSelected = NO;
+    NSArray *audioTrackIndexes = self.mediaPlayer.audioTrackIndexes;
+    if (row < audioTrackIndexes.count) {
+        isSelected = [audioTrackIndexes[row] intValue] == self.mediaPlayer.currentAudioTrackIndex;
+    }
     trackCell.selectionMarkerVisible = isSelected;
 
     NSString *trackName = self.mediaPlayer.audioTrackNames[row];