# Weird Error while running the program

**URL:** https://discourse.processing.org/t/weird-error-while-running-the-program/40730
**Category:** Processing
**Created:** [January 27, 2023, 2:20pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730 "2023-01-27T14:20:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Aryszin](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aryszin](https://discourse.processing.org/u/Aryszin)
#### Post date: [January 27, 2023, 2:20pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730/1 "2023-01-27T14:20:43Z")

</div>

I got this error:

> NullPointerException  
> 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(PApplet.java:9855)  
> at processing.core.PApplet.handleDraw(PApplet.java:2122)  
> at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:821)  
> 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:782)  
> at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)  
> at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:453)  
> at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)  
> at java.base/java.util.TimerThread.mainLoop(Timer.java:566)  
> at java.base/java.util.TimerThread.run(Timer.java:516)  
> NullPointerException

while running the sktech normaly

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 27, 2023, 3:21pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730/2 "2023-01-27T15:21:47Z")

</div>

> [@Aryszin](#):
>
> “java.util.Map.remove(…

please show the code for this

---

<div class="post-metadata">

### Author: ![Aryszin](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aryszin](https://discourse.processing.org/u/Aryszin)
#### Post date: [January 29, 2023, 1:13pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730/3 "2023-01-29T13:13:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 29, 2023, 3:27pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730/4 "2023-01-29T15:27:54Z")

</div>

I meant just the lines surrounding the line with

```
java.util.Map.remove(…

```

in it

---

<div class="post-metadata">

### Author: ![Aryszin](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aryszin](https://discourse.processing.org/u/Aryszin)
#### Post date: [February 2, 2023, 6:43pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730/5 "2023-02-02T18:43:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [February 2, 2023, 9:56pm UTC](https://discourse.processing.org/t/weird-error-while-running-the-program/40730/6 "2023-02-02T21:56:36Z")

</div>

> [@Aryszin](#):
>
> NullPointerException  
> 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(PApplet.java:9855)  
> at processing.core.PApplet.handleDraw(PApplet.java:2122)

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

```auto
Integer io;

void setup() {
  println(io.intValue());
}

```

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.
