Преглед на файлове

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

Brian Zinn преди 8 години
родител
ревизия
b5897fbbfd
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  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) {
             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) {