浏览代码

Fixed an dispose bug with input.gamepad.ts

David Catuhe 9 年之前
父节点
当前提交
9a5430337f
共有 1 个文件被更改,包括 4 次插入2 次删除
  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;
         }