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. :-)
> And here's an abbreviated version of the Node class.
Your exception isn't being caused at this line. Or your JVM is broken.
Or currentNode is winding up a subclass of Node with different code.
Print everything just before you get there, or wrap the whole
questionable chunk in a try/catch and print out everything when it throws.
--
Darren New / San Diego, CA, USA (PST)
It's not feature creep if you put it
at the end and adjust the release date.
Post a reply to this message
|