Skip to content

Commit

Permalink
fix: exception if on early adError (#4362)
Browse files Browse the repository at this point in the history
If onAdError is called before onAdStart_ then onAdComplete_ uses
this.ad_ which is undefined.

This can happen if a VAST XML file contains no ads.

Fixes #4004
  • Loading branch information
jukart authored and joeyparrish committed Aug 12, 2022
1 parent 874fcd6 commit 94413d2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Johan Sundström <[email protected]>
Jonas Birmé <[email protected]>
Jozef Chúťka <[email protected]>
Jun Hong Chong <[email protected]>
Jürgen Kartnaller <[email protected]>
JW Player <*@jwplayer.com>
Lucas Gabriel Sánchez <[email protected]>
Matthias Van Parijs <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Jonas Birmé <[email protected]>
Jono Ward <[email protected]>
Jozef Chúťka <[email protected]>
Jun Hong Chong <[email protected]>
Jürgen Kartnaller <[email protected]>
Leandro Ribeiro Moreira <[email protected]>
Lucas Gabriel Sánchez <[email protected]>
Matias Russitto <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion lib/ads/client_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ shaka.ads.ClientSideAdManager = class {
onAdComplete_(e) {
this.onEvent_(new shaka.util.FakeEvent(shaka.ads.AdManager.AD_STOPPED,
(new Map()).set('originalEvent', e)));
if (this.ad_.isLinear()) {
if (this.ad_ && this.ad_.isLinear()) {
this.adContainer_.removeAttribute('ad-active');
this.video_.play();
}
Expand Down

0 comments on commit 94413d2

Please sign in to comment.