Explorar o código

Check new camera to prevent null exception. Assigned null during dispose.

Brian Zinn %!s(int64=8) %!d(string=hai) anos
pai
achega
b5897fbbfd

+ 3 - 1
src/Cameras/Inputs/babylon.freeCameraDeviceOrientationInput.ts

@@ -22,7 +22,9 @@ module BABYLON {
 
         public set camera(camera: FreeCamera) {
             this._camera = camera;
-            if (!this._camera.rotationQuaternion) this._camera.rotationQuaternion = new Quaternion();
+            if (this._camera != null && !this._camera.rotationQuaternion) {
+                this._camera.rotationQuaternion = new Quaternion();
+            }
         }
 
         attachControl(element: HTMLElement, noPreventDefault?: boolean) {