Skip to content

Commit

Permalink
fix: prevent access to null config_ in SimpleAbrManager (shaka-projec…
Browse files Browse the repository at this point in the history
…t#5362)

Well sometimes network information change could be triggered even if
this.config_ is null, resulting in an exception thrown in the browser.
Doesn't affect playback, but affects the number of errors detected by
our tools 😅

Let's check if abrManager is enabled before checking its config
  • Loading branch information
valotvince committed Jun 27, 2023
1 parent 7d24e14 commit d1db694
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/abr/simple_abr_manager.js
Expand Up @@ -54,7 +54,7 @@ shaka.abr.SimpleAbrManager = class {
// of connectivity changes.
if (navigator.connection && navigator.connection.addEventListener) {
this.onNetworkInformationChange_ = () => {
if (this.config_.useNetworkInformation && this.enabled_) {
if (this.enabled_ && this.config_.useNetworkInformation) {
this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();
if (this.config_) {
this.bandwidthEstimator_.configure(this.config_.advanced);
Expand Down

0 comments on commit d1db694

Please sign in to comment.