Browse Source

Merge pull request #3374 from TrevorDev/webVRHelperDoNotDisposeNullObjects

check for null for meshes before disposing
David Catuhe 7 years ago
parent
commit
ac3aa0527e
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/Cameras/VR/babylon.vrExperienceHelper.ts

+ 7 - 2
src/Cameras/VR/babylon.vrExperienceHelper.ts

@@ -1386,8 +1386,13 @@ module BABYLON {
                 this._deviceOrientationCamera.dispose();
             }
 
-            this._gazeTracker.dispose();
-            this._teleportationTarget.dispose();
+            if(this._gazeTracker){
+                this._gazeTracker.dispose();
+            }
+            
+            if(this._teleportationTarget){
+                this._teleportationTarget.dispose();
+            }
 
             this._floorMeshesCollection = [];