소스 검색

Fix issue when compiling with closure compiler.

Fixes "Invalid delete operand. Only properties can be deleted." when compiling
with the closure compiler.
See https://forum.babylonjs.com/t/possible-bug-when-compiling-babylonjs-with-the-closure-compiler/9923
Sylvain Ageneau 5 년 전
부모
커밋
e60a46f6ae
2개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      dist/preview release/what's new.md
  2. 5 2
      src/Misc/depthReducer.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -138,6 +138,7 @@
 - Fix bug in `ShaderMaterial` when using morph targets ([Popov72](https://github.com/Popov72)
 - Fix bug in playground where child NME windows would not close before page unload events ([belfortk](https://github.com/belfortk)
 - Fixed an issue with stereoscopic rendering ([#8000](https://github.com/BabylonJS/Babylon.js/issues/8000)) ([RaananW](https://github.com/RaananW))
+- Fix an error when compiling with the closure compiler ([ageneau](https://github.com/ageneau/))
 
 ## Breaking changes
 

+ 5 - 2
src/Misc/depthReducer.ts

@@ -98,11 +98,14 @@ export class DepthReducer extends MinMaxReducer {
         super.dispose(disposeAll);
 
         if (this._depthRenderer && disposeAll) {
-            delete this._depthRenderer.getDepthMap().getScene()?._depthRenderer[this._depthRendererId];
+            const scene = this._depthRenderer.getDepthMap().getScene();
+            if (scene) {
+                delete scene._depthRenderer[this._depthRendererId];
+            }
 
             this._depthRenderer.dispose();
             this._depthRenderer = null;
         }
     }
 
-}
+}