Skip to content

Commit

Permalink
Fixes another null exception in cast receiver
Browse files Browse the repository at this point in the history
When calling getStats, if there is no active stream but there is
a playhead and manifest, the player experiences a null exception.
This does not fully fix #1128, however, as there seems to be more than
a null exception at work there at the moment.

Issue #1128

Change-Id: Ic9d318a037157c2a8e28a54a857ec3a1e5797aae
  • Loading branch information
theodab committed Dec 7, 2017
1 parent 834d960 commit bc5d309
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1527,12 +1527,14 @@ shaka.Player.prototype.getStats = function() {
var period = this.manifest_.periods[periodIdx];
var activeStreams = this.activeStreamsByPeriod_[periodIdx];

variant = shaka.util.StreamUtils.getVariantByStreamIds(
activeStreams[ContentType.AUDIO],
activeStreams[ContentType.VIDEO],
period.variants);
if (activeStreams) {
variant = shaka.util.StreamUtils.getVariantByStreamIds(
activeStreams[ContentType.AUDIO],
activeStreams[ContentType.VIDEO],
period.variants);

video = variant.video || {};
video = variant.video || {};
}
}

if (!video) video = {};
Expand Down

0 comments on commit bc5d309

Please sign in to comment.