|
|
"Darren New" <dne### [at] sanrrcom> wrote in message
news:47901c1d$1@news.povray.org...
> Gail Shaw wrote:
> > Is there anyone who can tell me why the following code sometimes (not
> > always) throws a NullPointerException
> > Using Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
> >
> > Node currentNode = Universe.space[i][j]; // Have checked and this is
never
> > null.
>
> Then you should have an assertion in there to that effect. :-)
Could, but the way the initialisation of the Universe works, if any Node was
null, things would break a lot earlier than this.
I have print statements. Removed from post for clarity.
> > And here's an abbreviated version of the Node class.
>
> Your exception isn't being caused at this line. Or your JVM is broken.
Both are possibilities I've considered.
> Or currentNode is winding up a subclass of Node with different code.
Nothing inherits from Node.
> Print everything just before you get there, or wrap the whole
> questionable chunk in a try/catch and print out everything when it throws.
I'll do that. Probably find the excption's migrated elsewhere.
What I find really odd is that the exception doesn't terminate execution,
which I thought it should (would in C#)
Unless the exception's coming from elsewhere (the IDE possibly, or some
graphical component)
Post a reply to this message
|
|