Crash when trying to read subtitle track for live tv.

This commit is contained in:
Jimi 2022-06-25 15:48:19 -06:00
parent e2b822291a
commit 349c5894bc

View File

@ -21,6 +21,7 @@ end function
' returns the server-side track index for the appriate subtitle
function defaultSubtitleTrackFromVid(video_id) as integer
meta = ItemMetaData(video_id)
if meta.json.mediaSources <> invalid
if meta = invalid then return invalid
subtitles = sortSubtitles(meta.id, meta.json.MediaSources[0].MediaStreams)
default_text_subs = defaultSubtitleTrack(subtitles["all"], true) ' Find correct subtitle track (forced text)
@ -29,6 +30,10 @@ function defaultSubtitleTrackFromVid(video_id) as integer
else
return defaultSubtitleTrack(subtitles["all"]) ' if no appropriate text subs exist, allow non-text
end if
end if
' No valid mediaSources (i.e. LiveTV)
return -1
end function