Skip to content

Commit

Permalink
fix: Add null check for current reference (#7184)
Browse files Browse the repository at this point in the history
Resolves #7174.
  • Loading branch information
willdharris authored and avelad committed Aug 26, 2024
1 parent 57d391d commit 4ae6082
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1516,11 +1516,14 @@ shaka.media.StreamingEngine = class {
mediaState.stream.segmentIndex,
'segment index should have been generated already');

if (mediaState.segmentIterator) {
const currentSegment = mediaState.segmentIterator ?
mediaState.segmentIterator.current() : null;

if (currentSegment) {
// Something is buffered from the same Stream. Use the current position
// in the segment index. This is updated via next() after each segment is
// appended.
return mediaState.segmentIterator.current();
return currentSegment;
} else if (mediaState.lastSegmentReference || bufferEnd) {
// Something is buffered from another Stream.
const time = mediaState.lastSegmentReference ?
Expand Down

0 comments on commit 4ae6082

Please sign in to comment.