Explorar o código

Fixed an dispose bug with input.gamepad.ts

David Catuhe %!s(int64=9) %!d(string=hai) anos
pai
achega
9a5430337f
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/Cameras/Inputs/babylon.freecamera.input.gamepad.ts

+ 4 - 2
src/Cameras/Inputs/babylon.freecamera.input.gamepad.ts

@@ -15,8 +15,10 @@ module BABYLON {
             this._gamepads = new Gamepads((gamepad: Gamepad) => { this._onNewGameConnected(gamepad); });
         }
         
-        detachControl(element : HTMLElement){
-            this._gamepads.dispose();
+        detachControl(element: HTMLElement) {
+            if (this._gamepads) {
+                this._gamepads.dispose();
+            }
             this.gamepad = null;
         }