- 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. 19
      engine/src/lwjgl/com/jme3/input/lwjgl/LwjglMouseInput.java

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

Loading…
Cancel
Save