ensure vars are valid - fixes line 370 + 386 crash

This commit is contained in:
Charles Ewert 2023-03-02 11:57:31 -05:00
parent 57a4a5cf38
commit b14bdd019a

View File

@ -402,33 +402,33 @@ sub Main (args as dynamic) as void
' If a button is selected, we have some determining to do ' If a button is selected, we have some determining to do
btn = getButton(msg) btn = getButton(msg)
group = sceneManager.callFunc("getActiveScene") group = sceneManager.callFunc("getActiveScene")
if btn <> invalid and btn.id = "play-button" if isValid(btn) and btn.id = "play-button"
' Check if a specific Audio Stream was selected ' Check if a specific Audio Stream was selected
audio_stream_idx = 1 audio_stream_idx = 1
if group.selectedAudioStreamIndex <> invalid if isValid(group?.selectedAudioStreamIndex)
audio_stream_idx = group.selectedAudioStreamIndex audio_stream_idx = group.selectedAudioStreamIndex
end if end if
' Check to see if a specific video "version" was selected ' Check to see if a specific video "version" was selected
mediaSourceId = invalid mediaSourceId = invalid
if group.selectedVideoStreamId <> invalid if isValid(group?.selectedVideoStreamId)
mediaSourceId = group.selectedVideoStreamId mediaSourceId = group.selectedVideoStreamId
end if end if
video_id = group.id video_id = group.id
video = CreateVideoPlayerGroup(video_id, mediaSourceId, audio_stream_idx) video = CreateVideoPlayerGroup(video_id, mediaSourceId, audio_stream_idx)
if video <> invalid and video.errorMsg <> "introaborted" if isValid(video) and video.errorMsg <> "introaborted"
sceneManager.callFunc("pushScene", video) sceneManager.callFunc("pushScene", video)
end if end if
if group.lastfocus.id = "main_group" if isValid(group?.lastfocus?.id) = "main_group"
buttons = group.findNode("buttons") buttons = group.findNode("buttons")
if isValid(buttons) if isValid(buttons)
group.lastfocus = group.findNode("buttons") group.lastfocus = group.findNode("buttons")
end if end if
end if end if
if group.lastFocus <> invalid if isValid(group?.lastfocus)
group.lastFocus.setFocus(true) group.lastFocus.setFocus(true)
end if end if