diff --git a/components/ItemGrid/LoadVideoContentTask.bs b/components/ItemGrid/LoadVideoContentTask.bs index fcea7c58..b2d4bcb9 100644 --- a/components/ItemGrid/LoadVideoContentTask.bs +++ b/components/ItemGrid/LoadVideoContentTask.bs @@ -248,7 +248,14 @@ function defaultSubtitleTrackFromVid(videoID) as integer if not isValidAndNotEmpty(meta.json.MediaSources[0].MediaStreams) then return SubtitleSelection.none subtitles = sortSubtitles(meta.id, meta.json.MediaSources[0].MediaStreams) - selectedAudioLanguage = meta.json.MediaSources[0].MediaStreams[m.top.selectedAudioStreamIndex].Language ?? "" + + selectedAudioLanguage = "" + audioMediaStream = meta.json.MediaSources[0].MediaStreams[m.top.selectedAudioStreamIndex] + + ' Ensure audio media stream is valid before using language property + if isValid(audioMediaStream) + selectedAudioLanguage = audioMediaStream.Language ?? "" + end if defaultTextSubs = defaultSubtitleTrack(subtitles["text"], selectedAudioLanguage, true) ' Find correct subtitle track (forced text) if defaultTextSubs <> SubtitleSelection.none