فهرست منبع

fixed an issue where calling setCursorVisible on the ChaseCameraAppstate before it's initialized was causing an NPE.

Nehon 10 سال پیش
والد
کامیت
7c41355cca
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java

+ 4 - 1
jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java

@@ -127,6 +127,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
         initTogleRotateInput();
 
         inputManager.addListener(this, inputs);
+        inputManager.setCursorVisible(dragToRotate);
     }
 
     public void onAction(String name, boolean keyPressed, float tpf) {
@@ -429,7 +430,9 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
     public void setDragToRotate(boolean dragToRotate) {
         this.dragToRotate = dragToRotate;
         this.canRotate = !dragToRotate;
-        inputManager.setCursorVisible(dragToRotate);
+        if(inputManager != null){
+            inputManager.setCursorVisible(dragToRotate);
+        }
     }
 
     /**