From bb9711639c8b09d369b38b441eb1283e85838a46 Mon Sep 17 00:00:00 2001 From: Slowlife01 Date: Wed, 2 Apr 2025 21:36:15 +0700 Subject: [PATCH] fix: add null checks for media controller --- src/browser/base/zen-components/ZenMediaController.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/browser/base/zen-components/ZenMediaController.mjs b/src/browser/base/zen-components/ZenMediaController.mjs index 6dce54585..029407918 100644 --- a/src/browser/base/zen-components/ZenMediaController.mjs +++ b/src/browser/base/zen-components/ZenMediaController.mjs @@ -148,7 +148,9 @@ class ZenMediaController { } showMediaControls() { - if (this._currentMediaController?.isBeingUsedInPIPModeOrFullscreen) return this.hideMediaControls(); + if (!this._currentMediaController) return; + + if (this._currentMediaController.isBeingUsedInPIPModeOrFullscreen) return this.hideMediaControls(); if (!this.mediaControlBar.hasAttribute('hidden')) return; this.updatePipButton(); @@ -485,6 +487,8 @@ class ZenMediaController { } updatePipButton() { + if (!this._currentBrowser) return; + const isPipEligible = this.pipEligibilityMap.get(this._currentBrowser.browserId); if (isPipEligible) this.mediaControlBar.setAttribute('can-pip', ''); else this.mediaControlBar.removeAttribute('can-pip');