Skip to content

Commit

Permalink
prevent crash when there are no media streams
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Oct 9, 2024
1 parent 55045b6 commit cc34dd1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/api/Items.bs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioT
params.EnableDirectPlay = false
end if

if audioTrackIndex > -1
selectedAudioStream = m.global.session.video.json.MediaStreams[audioTrackIndex]
myGLobal = m.global

if audioTrackIndex > -1 and myGLobal.session.video.json.MediaStreams <> invalid
selectedAudioStream = myGLobal.session.video.json.MediaStreams[audioTrackIndex]

if selectedAudioStream <> invalid
params.AudioStreamIndex = audioTrackIndex
Expand All @@ -62,7 +64,6 @@ function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioT
end for
end if
end if

end if
end if

Expand Down

0 comments on commit cc34dd1

Please sign in to comment.