Skip to content

Commit

Permalink
Add destruction check in Stream.switch().
Browse files Browse the repository at this point in the history
This check is necessary since Stream does not own its StreamInfo,
so the async part of switch() may complete even if
Stream.destroy() is called

Change-Id: I5185c0df3184924d0f34d39e235b1155f01dd273
  • Loading branch information
Timothy Drews authored and Gerrit Code Review committed Aug 21, 2015
1 parent df29182 commit e02f74a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/media/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ shaka.media.Stream.prototype.switch = function(
Promise.all(async).then(shaka.util.TypedBind(this,
/** @param {!Array} results */
function(results) {
if (!this.video_) {
// We got destroyed.
return;
}

var previousStreamInfo = this.streamInfo_;

this.streamInfo_ = streamInfo;
Expand Down

0 comments on commit e02f74a

Please sign in to comment.