Browse Source

Fixed an dispose bug with input.gamepad.ts

David Catuhe 9 years ago
parent
commit
9a5430337f
1 changed files with 4 additions and 2 deletions
  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;
         }