ensure selectedSubtitle is valid before using - fixes crash on line 87
This commit is contained in:
parent
b91b2c582d
commit
089708c6d9
|
@ -84,6 +84,7 @@ function setupSubtitle(video, subtitles, subtitle_idx = -1) as integer
|
|||
|
||||
selectedSubtitle = subtitles[subtitleSelIdx]
|
||||
|
||||
if isValid(selectedSubtitle) and isValid(selectedSubtitle.IsEncoded)
|
||||
if selectedSubtitle.IsEncoded
|
||||
' With encoded subtitles, turn off captions
|
||||
video.globalCaptionMode = "Off"
|
||||
|
@ -92,9 +93,9 @@ function setupSubtitle(video, subtitles, subtitle_idx = -1) as integer
|
|||
video.globalCaptionMode = "On"
|
||||
video.subtitleTrack = video.availableSubtitleTracks[availSubtitleTrackIdx(video, subtitleSelIdx)].TrackName
|
||||
end if
|
||||
end if
|
||||
|
||||
return subtitleSelIdx
|
||||
|
||||
end function
|
||||
|
||||
' The subtitle index on the server differs from the index we track locally
|
||||
|
|
Loading…
Reference in New Issue
Block a user