# Null pointer error in thread

**URL:** <https://discourse.processing.org/t/null-pointer-error-in-thread/21499>\
**Category:** Coding Questions\
**Created:** [June 2, 2020, 8:51am UTC](https://discourse.processing.org/t/null-pointer-error-in-thread/21499 "2020-06-02T08:51:11Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 2, 2020, 9:05am UTC](https://discourse.processing.org/t/null-pointer-error-in-thread/21499/4 "2020-06-02T09:05:32Z")

</div>

Implement a method named **post()** **draw()** inside your class A, and then **registerMethod()** it: 👾

> [@Fisica's FGearJoint](https://discourse.processing.org/t/fisicas-fgearjoint/18037/2):
>
> I’ve taken a quick look at Fisica’s source code and found out the reason for the NPE is that invoking method getBox2dJoint() on both FRevoluteJoint objects return null: println(revJointA.getBox2dJoint()); // null println(revJointB.getBox2dJoint()); // null But mysteriously after the 1st draw() iteration, those same statements don’t log null anymore. So I’ve used registerMethod() in order to setup a post() callback which would be run once only and then got unregisterMethod(): [Processing.GitHu…](http://Processing.GitHub.io/processing-javadocs/core/processing/core/PApplet.html#registerMethod-java.lang.String-java.lang.Object-)

---

_[View the full topic](https://discourse.processing.org/t/null-pointer-error-in-thread/21499)._
