Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

When I execute this code it gives me the Exception Glthread 8 Java.lang.null.pointer

MouseJointDef md = new MouseJointDef();  
md.bodyA = _body;
md.bodyB = _body;
md.target.set(locationWorld);
md.collideConnected = true;
md.maxForce = 1000.0f * _body.getMass();

_mouseJoint =  (MouseJoint) _world.createJoint(md);
_body.setAwake(true);

Thanks.

share|improve this question

closed as too localized by Tetrad Jan 27 '12 at 18:12

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Which line exactly? –  Maik Semder Aug 13 '11 at 10:47
    
Body A and B are the same for the joint? You sure that makes sense? –  Maik Semder Aug 13 '11 at 10:48
4  
Voted to close as too localized. Make use of the debugger? –  bummzack Aug 13 '11 at 11:10
1  
Have you stepped through the code in a debugger to see which variable is null? –  ChrisF Aug 13 '11 at 13:31
1  
GDSE is not a debugger –  Ray Dey Aug 13 '11 at 15:20

1 Answer 1

This is a case of "give a man a fish/teach a man to fish". You should learn to use the debugger to figure this problem out yourself.

Here is a good place to start:

http://www.infinitezest.com/articles/debugging-an-android-application.aspx

and you can find more here:

the google

FWIW as your code stands, the most likely perpetrator are md.target, _body and _world.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.