From 7cf7009112093b8f852af544b73994b2c243fc55 Mon Sep 17 00:00:00 2001 From: Theodore Abshire Date: Fri, 20 May 2022 00:49:19 -0700 Subject: [PATCH] fix: Don't send drmsessionupdate after unload There is an async call, waiting for sessions to update, right before the StreamingEngine fires off an drmsessionupdate event. This could potentially cause an error, as the StreamingEngine's player interface could potentially be set to null during destruction. This adds a check to see if the StreamingEngine has been destroyed, to catch that case. Based on a test failure of #4241 --- lib/media/drm_engine.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index 0603dd3416..b3d6c343f4 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -1424,6 +1424,9 @@ shaka.media.DrmEngine = class { } return; } + if (this.destroyer_.destroyed()) { + return; + } const updateEvent = new shaka.util.FakeEvent('drmsessionupdate'); this.playerInterface_.onEvent(updateEvent);