Browse Source

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

Brian Zinn 8 years ago
parent
commit
b5897fbbfd
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Cameras/Inputs/babylon.freeCameraDeviceOrientationInput.ts

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

@@ -22,7 +22,9 @@ module BABYLON {
 
 
         public set camera(camera: FreeCamera) {
         public set camera(camera: FreeCamera) {
             this._camera = camera;
             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) {
         attachControl(element: HTMLElement, noPreventDefault?: boolean) {