From a5a9966b4e40bc4fee8afce9db5697499a604464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Codar?= Date: Wed, 20 Nov 2024 17:18:16 +0300 Subject: [PATCH] fix: document.currentScript is null exception fixes "Cannot read properties of null (reading 'src')" exception --- src/ts/web-ifc-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ts/web-ifc-api.ts b/src/ts/web-ifc-api.ts index cd9a4f6d..3b7b39ba 100644 --- a/src/ts/web-ifc-api.ts +++ b/src/ts/web-ifc-api.ts @@ -29,7 +29,7 @@ let WebIFCWasm: any; let currentScriptPath: string; if (typeof document !== 'undefined') { const currentScriptData = (document.currentScript as HTMLScriptElement); - if (typeof currentScriptData.src !== 'undefined') currentScriptPath = currentScriptData.src.substring(0, currentScriptData.src.lastIndexOf("/") + 1) ; + if (typeof currentScriptData?.src !== 'undefined') currentScriptPath = currentScriptData.src.substring(0, currentScriptData.src.lastIndexOf("/") + 1) ; } export * from "./ifc-schema";