I have just a "Simple" Synchronized Lock Block as such:
private final Object screenLock = new Object();
public void Update(double deltaTime)
{
synchronized (screenLock)
{
screenManager.Update(deltaTime);
}
}
public void Draw()
{
synchronized (screenLock)
{
screenManager.Draw();
}
}
deltaTime isn't null, screenManager isn't null, so I'm a little lost.
I know that I shouldn't be putting a lock on such a High level, but the problem persists wherever I put the Block. I have two threads running to Update and Draw both with screenLock.
What would cause the NullPointerException on the lock?
Trace:
java.lang.NullPointerException at com.dnx.manavo.ScreenManager.Update(ScreenManager.java:107) at com.dnx.manavo.ApplicationActivity.Update(ApplicationActivity.java:98) at com.dnx.manavo.GameThread.run(GameThread.java:43)
Thanks to @Adam Batkin, and @MadProgrammer - I found my specific NullPointerException within some parts of the screenManager
I did some research and sometimes a NullPointerException will be thrown at the begining of the Synchronized Block, but in fact its being thrown within the Block.
Other Reasons:
screenLock is nullIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With