From 6e27fc70967da480b4b3938923fcb3aec7b4b463 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:54:15 +1100 Subject: [PATCH] Remove a non-null assertion --- src/components/maincontroller.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/maincontroller.ts b/src/components/maincontroller.ts index 5a25232b..de18af9e 100644 --- a/src/components/maincontroller.ts +++ b/src/components/maincontroller.ts @@ -412,10 +412,9 @@ export function setSubtitleStreamIndex( return; } - const mediaStreams = state.PlaybackMediaSource?.MediaStreams; + const mediaStreams = state.PlaybackMediaSource?.MediaStreams ?? []; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const subtitleStream = getStreamByIndex(mediaStreams!, 'Subtitle', index); + const subtitleStream = getStreamByIndex(mediaStreams, 'Subtitle', index); if (!subtitleStream) { console.log(