- Fixed NPE when passing a null cursor to reset cursor to default.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10355 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
dan..om 12 years ago
parent d729bbc43a
commit 94d036e58d
  1. 5
      engine/src/lwjgl/com/jme3/input/lwjgl/LwjglMouseInput.java

@ -153,7 +153,9 @@ public class LwjglMouseInput implements MouseInput {
public void setNativeCursor(JmeCursor jmeCursor) { public void setNativeCursor(JmeCursor jmeCursor) {
try { try {
Cursor newCursor = new Cursor( Cursor newCursor = null;
if (jmeCursor != null) {
newCursor = new Cursor(
jmeCursor.getWidth(), jmeCursor.getWidth(),
jmeCursor.getHeight(), jmeCursor.getHeight(),
jmeCursor.getXHotSpot(), jmeCursor.getXHotSpot(),
@ -161,6 +163,7 @@ public class LwjglMouseInput implements MouseInput {
jmeCursor.getNumImages(), jmeCursor.getNumImages(),
jmeCursor.getImagesData(), jmeCursor.getImagesData(),
jmeCursor.getImagesDelay()); jmeCursor.getImagesDelay());
}
Mouse.setNativeCursor(newCursor); Mouse.setNativeCursor(newCursor);
} catch (LWJGLException ex) { } catch (LWJGLException ex) {
Logger.getLogger(LwjglMouseInput.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(LwjglMouseInput.class.getName()).log(Level.SEVERE, null, ex);

Loading…
Cancel
Save