Pomax / Pjs-2D-Game-Engine

Processing.js 2D Game Engine
85 stars 53 forks source link

Null Pointer Exception with ViewBox Class #14

Closed epje closed 6 years ago

epje commented 6 years ago

Whilst using some methods from the ViewBox class in my code, I encounter a Null Pointer Exception with the following line(s) of code:

setLevelLayer(who.getLevelLayer()); float ax = round(who.getX()), ay = round(who.getY());

I'm using Processing 3.3.6, could this be the issue?

Pomax commented 6 years ago

you wouldn't be getting the null pointer on both lines, I assume this is about who being null rather than the object your code expects it to do. Try a println(who == null) before them to see if that prints true. If so, the code that's assigning who will need some extra care.