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 › null pointer error
Page Index Toggle Pages: 1
null pointer error (Read 507 times)
null pointer error
Sep 1st, 2007, 5:15pm
 
Hey
I can't figure out why I'm getting an error
java.lang.NullPointerException
it keeps syaing the error is happening here

albums[0].setPosition(int(xpos+sin(anglealbums+angle)*radius),int(ypos+cos(anglealbums+an
gle)*radius));
    image(b, xpos+sin((2*anglealbums)+angle)*radius, ypos+cos((2*anglealbums)+angle)*radius);
    albums[1].setPosition(int(xpos+sin(2*anglealbums+angle)*radius),int(ypos+cos(2*anglealbum
s+angle)*radius));
    image(c, xpos+sin((3*anglealbums)+angle)*radius, ypos+cos((3*anglealbums)+angle)*radius);
    albums[2].setPosition(int(xpos+sin(3*anglealbums+angle)*radius),int(ypos+cos(3*anglealbum
s+angle)*radius));
    image(d, xpos+sin((4*anglealbums)+angle)*radius, ypos+cos((4*anglealbums)+angle)*radius);
    albums[3].setPosition(int(xpos+sin(4*anglealbums+angle)*radius),int(ypos+cos(4*anglealbum
s+angle)*radius));
    image(e, xpos+sin((5*anglealbums)+angle)*radius, ypos+cos((5*anglealbums)+angle)*radius);
    albums[4].setPosition(int(xpos+sin(5*anglealbums+angle)*radius),int(ypos+cos(5*anglealbum
s+angle)*radius));
    image(f, xpos+sin((6*anglealbums)+angle)*radius, ypos+cos((6*anglealbums)+angle)*radius);
    albums[5].setPosition(int(xpos+sin(6*anglealbums+angle)*radius),int(ypos+cos(6*anglealbum
s+angle)*radius));
   
Re: null pointer error
Reply #1 - Sep 2nd, 2007, 12:06pm
 
so, at least one of the varibales you're accessing is Null.

Try to find which of your variables does not yet have an assigned value. Just start debugging using println(variable) to find which one(s) is/are causing trouble.
Re: null pointer error
Reply #2 - Sep 2nd, 2007, 1:07pm
 
got it thanks!
Page Index Toggle Pages: 1