From 922bf7e2e94e0d1f6675cf59e7c7d3f1e4915059 Mon Sep 17 00:00:00 2001 From: Manuel Date: Fri, 29 Jul 2022 13:23:49 +0200 Subject: [PATCH] fix: guard against invalid accesses Current check does only check for presence of document and assumes the full tree below exists but that is not always the case and can lead to exceptions. --- src/Modal/modalStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modal/modalStore.js b/src/Modal/modalStore.js index a985b906..488b8d5e 100644 --- a/src/Modal/modalStore.js +++ b/src/Modal/modalStore.js @@ -31,6 +31,6 @@ export const trackModal = (openStore) => }); modalsOpen.subscribe((openCount) => { - if (typeof document !== "undefined") + if (typeof document !== "undefined" && document.body && document.body.classList && typeof document.body.classList.toggle === "function") document.body.classList.toggle("bx--body--with-modal-open", openCount > 0); });