From 9bc8580f995b505062d259dfd3087fe6f01678b9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 18 Oct 2022 21:00:20 +0200 Subject: [PATCH] Do not crash on resize when application has not started yet. --- profiler/build/wasm/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profiler/build/wasm/index.html b/profiler/build/wasm/index.html index 2246823b..fc5baf50 100644 --- a/profiler/build/wasm/index.html +++ b/profiler/build/wasm/index.html @@ -92,7 +92,9 @@ function resizeHandler() { let w = Math.floor(Math.floor(window.innerWidth * window.devicePixelRatio) / window.devicePixelRatio); let h = Math.floor(Math.floor(window.innerHeight * window.devicePixelRatio) / window.devicePixelRatio); - Module.ccall('nativeResize', 'number', ['number', 'number'], [w * window.devicePixelRatio, h * window.devicePixelRatio]); + if(preloadElement.hidden === true) { + Module.ccall('nativeResize', 'number', ['number', 'number'], [w * window.devicePixelRatio, h * window.devicePixelRatio]); + } Module.canvas.style.width = w + 'px'; Module.canvas.style.height = h + 'px'; }