Merge pull request #1671 from 1hitsong/fixNoAudioStreamCrash
Fix no audio stream crash
This commit is contained in:
commit
20d2583daf
|
@ -248,7 +248,14 @@ function defaultSubtitleTrackFromVid(videoID) as integer
|
||||||
if not isValidAndNotEmpty(meta.json.MediaSources[0].MediaStreams) then return SubtitleSelection.none
|
if not isValidAndNotEmpty(meta.json.MediaSources[0].MediaStreams) then return SubtitleSelection.none
|
||||||
|
|
||||||
subtitles = sortSubtitles(meta.id, meta.json.MediaSources[0].MediaStreams)
|
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)
|
defaultTextSubs = defaultSubtitleTrack(subtitles["text"], selectedAudioLanguage, true) ' Find correct subtitle track (forced text)
|
||||||
if defaultTextSubs <> SubtitleSelection.none
|
if defaultTextSubs <> SubtitleSelection.none
|
||||||
|
|
Loading…
Reference in New Issue
Block a user