From 7b2be12587ba95d838c006078e5d71cb8dd0f1a4 Mon Sep 17 00:00:00 2001 From: Marc-Andre Ferland Date: Sat, 10 Dec 2022 18:26:48 -0500 Subject: [PATCH] Check if window is defined. Not all JS execution environments have it. --- ui/media/js/engine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/media/js/engine.js b/ui/media/js/engine.js index dd34ddb1..32b609d0 100644 --- a/ui/media/js/engine.js +++ b/ui/media/js/engine.js @@ -1081,7 +1081,7 @@ function getServerCapacity() { let activeDevicesCount = Object.keys(serverState?.devices?.active || {}).length - if (window.document.visibilityState === 'hidden') { + if (typeof window === "object" && window.document.visibilityState === 'hidden') { activeDevicesCount = 1 + activeDevicesCount } return activeDevicesCount