Weird Error while running the program

I got this error:

java.lang.NullPointerException: Cannot invoke “java.lang.Integer.intValue()” because the return value of “java.util.Map.remove(Object)” is null
at processing.core.PApplet.dequeueWindowEvents(
at processing.core.PApplet.handleDraw(
at processing.opengl.PSurfaceJOGL$DrawListener.display(
at jogamp.opengl.GLDrawableHelper.displayImpl(
at jogamp.opengl.GLDrawableHelper.display(
at jogamp.opengl.GLAutoDrawableBase$
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(
at jogamp.opengl.GLDrawableHelper.invokeGL(
at com.jogamp.newt.opengl.GLWindow.display(
at com.jogamp.opengl.util.AWTAnimatorImpl.display(
at com.jogamp.opengl.util.AnimatorBase.display(
at com.jogamp.opengl.util.FPSAnimator$
at java.base/java.util.TimerThread.mainLoop(
at java.base/

while running the sktech normaly

please show the code for this

its 7 tabs with 6 classes & 1 main script. it has over 2000 lines of code!

I meant just the lines surrounding the line with


in it

1 Like

im sorry i dont know what you mean i dont have anything in my code that says “remove(”

1 Like

Without knowing the exact version of Processing you are using we can’t use the line numbers to find the actual source code that is generating the NPE so a little bit of guess work is needed.

java.lang.Integer.intValue() converts an Integer object into a primitive int variable so if we try this sketch we get the same NPE

Integer io;

void setup() {

but the next part is challenging
because the return value of “java.util.Map.remove(Object)” is null

you say you are not calling the remove method but are you using HashMaps and if so what methods in this class are you using.

1 Like