jdf / peasycam

Dead-simple mouse-driven camera for Processing
http://MrFeinberg.com/peasycam/
Apache License 2.0
116 stars 35 forks source link

Getting NullPointerException when setting wheel handler to null #35

Closed mlwyatt closed 6 years ago

mlwyatt commented 6 years ago

Either I'm doing something wrong or null can't be passed in to setWheelHandler() like the documentation says. It appears that cam.setCenterDragHandler(null); and cam.setRightDragHandler(null); work as expected and documented. Any help, if I'm doing this wrong, would be appreciated. Thanks!

cam.setWheelHandler(null); // throws NullPointerException
cam.setWheelScale(0); // workaround
java.lang.NullPointerException
    at peasy.PeasyCam$PeasyEventListener.mouseEvent(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1408)
    at processing.core.PApplet.handleMethods(PApplet.java:1610)
    at processing.core.PApplet.handleMouseEvent(PApplet.java:2674)
    at processing.core.PApplet.dequeueEvents(PApplet.java:2596)
    at processing.core.PApplet.handleDraw(PApplet.java:2437)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:866)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
jdf commented 6 years ago

Thanks for the very helpful report.