Box2D Forums

It is currently Sun May 19, 2013 6:03 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Mar 26, 2012 1:41 pm 
Offline

Joined: Mon Mar 26, 2012 1:31 pm
Posts: 18
Not sure if this bug is specific to JBox2D, but it's what I'm using.

The game will run normally, but seemingly at random I get a NullPointerException within world.step(). There's probably a specific reason why this occurs, but I can't find it, nor do I have any idea where to look. Anyone have any ideas as to why this would even occur?


Top
 Profile  
 
PostPosted: Mon Mar 26, 2012 4:21 pm 
Offline

Joined: Tue Mar 20, 2012 2:36 pm
Posts: 3
Try to add the jbox2d source code to your project and step into the World.step() method. Or just wait for the exception to be raised, then check the call stack and put some breakpoints.


Top
 Profile  
 
PostPosted: Tue Mar 27, 2012 8:43 am 
Offline

Joined: Mon Mar 26, 2012 1:31 pm
Posts: 18
Step into the method? With a debugger? But, as I said, it appears at seemingly random. If the program pauses every time it hits world.step(), I could be at it forever.


Top
 Profile  
 
PostPosted: Tue Mar 27, 2012 9:14 am 
Offline

Joined: Tue Mar 20, 2012 2:36 pm
Posts: 3
1) Attach jbox2d source to your project
2) Run in debug mode
3) Wait for your random exception
4) Check the call stack
5) Put a conditional breakpoint on the excepting instruction (kind of "stop if var == null")
6) Rerun and wait for the debugger to stop
7) Guess what's wrong :D


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 2:51 pm 
Offline

Joined: Mon Mar 26, 2012 1:31 pm
Posts: 18
Well I got a stack trace, but it doesn't help me. I mean, I can see where in world.step() that it crashes, but I have no idea what I can do about it.


Code:
04-11 15:47:21.378: E/AndroidRuntime(5822): FATAL EXCEPTION: Thread-20
04-11 15:47:21.378: E/AndroidRuntime(5822): java.lang.NullPointerException
04-11 15:47:21.378: E/AndroidRuntime(5822):    at org.jbox2d.dynamics.ContactManager.addPair(ContactManager.java:73)
04-11 15:47:21.378: E/AndroidRuntime(5822):    at org.jbox2d.collision.broadphase.BroadPhase.updatePairs(BroadPhase.java:191)
04-11 15:47:21.378: E/AndroidRuntime(5822):    at org.jbox2d.dynamics.ContactManager.findNewContacts(ContactManager.java:155)
04-11 15:47:21.378: E/AndroidRuntime(5822):    at org.jbox2d.dynamics.World.solve(World.java:1017)
04-11 15:47:21.378: E/AndroidRuntime(5822):    at org.jbox2d.dynamics.World.step(World.java:560)


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 3:04 pm 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
which version of the engine are you running


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 3:39 pm 
Offline

Joined: Mon Mar 26, 2012 1:31 pm
Posts: 18
The name of the jar file has 2.1.2.


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 4:05 pm 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
2.1.2.?


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 4:09 pm 
Offline

Joined: Mon Mar 26, 2012 1:31 pm
Posts: 18
Yes, 2.1.2


Top
 Profile  
 
PostPosted: Wed Apr 11, 2012 4:56 pm 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
Sorry, 2.1.2.x, what is x?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group