Skip to content

Commit

Permalink
Prevent crash when there are no media streams (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert authored Oct 15, 2024
1 parent 5cf0a6f commit 2d91603
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 2d91603

Please sign in to comment.