From bd62034874ab7832ba1a1b9eb3b8c0c1893812f7 Mon Sep 17 00:00:00 2001 From: kejiaxiaoluo Date: Mon, 19 Aug 2024 16:57:01 +0800 Subject: [PATCH] Update SceneHelper.js fix: when texure resource loaded, zr may null --- src/component/common/SceneHelper.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/component/common/SceneHelper.js b/src/component/common/SceneHelper.js index 7bf41600..4a33804a 100644 --- a/src/component/common/SceneHelper.js +++ b/src/component/common/SceneHelper.js @@ -80,7 +80,10 @@ SceneHelper.prototype = { self._skybox.setEnvironmentMap(lights.specular.cubemap); } - api.getZr().refresh(); + var zr = api.getZr(); + if (zr) { + zr.refresh(); + } }); } this._lightRoot.add(lights.diffuse); @@ -180,4 +183,4 @@ SceneHelper.prototype = { } }; -export default SceneHelper; \ No newline at end of file +export default SceneHelper;