From b3fde192b6261c018c108c86666153bc195e83a5 Mon Sep 17 00:00:00 2001 From: Devoxin Date: Wed, 25 Sep 2024 21:03:03 +0100 Subject: [PATCH] Fix accessing sequence of null SequenceInfo --- .../youtube/track/YoutubeMpegStreamAudioTrack.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/dev/lavalink/youtube/track/YoutubeMpegStreamAudioTrack.java b/common/src/main/java/dev/lavalink/youtube/track/YoutubeMpegStreamAudioTrack.java index 0f7d728..3379ed1 100644 --- a/common/src/main/java/dev/lavalink/youtube/track/YoutubeMpegStreamAudioTrack.java +++ b/common/src/main/java/dev/lavalink/youtube/track/YoutubeMpegStreamAudioTrack.java @@ -95,8 +95,11 @@ private void updateGlobalSequence() { file.parseHeaders(); SequenceInfo sequenceInfo = extractAbsoluteSequenceFromEvent(file.getLastEventMessage()); - state.globalSequence = sequenceInfo.sequence; - state.globalSequenceDuration = sequenceInfo.duration; + + if (sequenceInfo != null) { + state.globalSequence = sequenceInfo.sequence; + state.globalSequenceDuration = sequenceInfo.duration; + } } catch (IOException ignored) { } @@ -194,7 +197,11 @@ private void processSegmentStream(SeekableInputStream stream, AudioProcessingCon if (!trackInfo.isStream) { state.absoluteSequence++; } else { - state.absoluteSequence = extractAbsoluteSequenceFromEvent(file.getLastEventMessage()).sequence; + SequenceInfo sequenceInfo = extractAbsoluteSequenceFromEvent(file.getLastEventMessage()); + + if (sequenceInfo != null) { + state.absoluteSequence = sequenceInfo.sequence; + } } if (state.trackConsumer == null) {