We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › NullPointerException with physics library -
Page Index Toggle Pages: 1
NullPointerException with physics library - ? (Read 833 times)
NullPointerException with physics library - ?
Dec 8th, 2006, 3:49pm
 
Hi there I am building a complicated application with the traer.physics library. Can anybody help me track down the error/build an exception check? Where should the exception check go?


java.lang.NullPointerException

at traer.physics.ParticleSystem.applyForces(ParticleSystem.java:123)

at traer.physics.RungeKuttaIntegrator.step(RungeKuttaIntegrator.java:193)

at traer.physics.ParticleSystem.tick(ParticleSystem.java:48)

at Temporary_3929_814.normal(Temporary_3929_814.java:122)

at Temporary_3929_814.draw(Temporary_3929_814.java:111)

at processing.core.PApplet.handleDisplay(PApplet.java:1318)

at processing.core.PGraphics.requestDisplay(PGraphics.java:564)

at processing.core.PApplet.run(PApplet.java:1413)

at java.lang.Thread.run(Thread.java:613)

java.lang.NullPointerException

at traer.physics.ParticleSystem.applyForces(ParticleSystem.java:123)

at traer.physics.RungeKuttaIntegrator.step(RungeKuttaIntegrator.java:193)

at traer.physics.ParticleSystem.tick(ParticleSystem.java:48)

at Temporary_3929_814.normal(Temporary_3929_814.java:122)

at Temporary_3929_814.draw(Temporary_3929_814.java:111)

at processing.core.PApplet.handleDisplay(PApplet.java:1318)

at processing.core.PGraphics.requestDisplay(PGraphics.java:564)

at processing.core.PApplet.run(PApplet.java:1413)

at java.lang.Thread.run(Thread.java:613)
Re: NullPointerException with physics library - ?
Reply #1 - Dec 8th, 2006, 5:16pm
 
Ok I figured out that it is the

physics.tick( 1.0 );

that is throwing the exception. Is that a bad thing if i catch it and carry on? How can I avoid it?
Re: NullPointerException with physics library - ?
Reply #2 - Dec 8th, 2006, 5:30pm
 
I think it means there's a problem with your physics setup (null force, divide by zero etc) and just ignoring the error will mean you may only get some forces applied to some particles and the whole system may well be unreliable and inconsistent.
Re: NullPointerException with physics library - ?
Reply #3 - Dec 16th, 2006, 10:03pm
 
Sounds like you made a force with a particle that was null...
Page Index Toggle Pages: 1