POV-Ray : Newsgroups : povray.off-topic : Any Java experts? : Re: Any Java experts? Server Time
10 Oct 2024 23:18:53 EDT (-0400)
  Re: Any Java experts?  
From: Orchid XP v7
Date: 17 Jan 2008 16:15:21
Message: <478fc569$1@news.povray.org>
Gail Shaw wrote:

> boolean hasShip() {
> if (localShip!=null)
> return true;
> else
> return false;
> }

This cannot possibly throw a null pointer exception.

 > Node currentNode = Universe.space[i][j]; // Have checked and this is 
never
 > null.
 > if (currentNode.hasShip()) { // <-- This line sometimes throws a
 > NullPointerException

The only way for a null pointer exception to occur is if currentNode is 
null.

Looks like whatever initialises Universe.space isn't doing it right, or 
has some kind of intermittent bug or something. (Alternatively, the 
exception isn't comming from where you say it is.)

Realistically, you'll probably need to run the code through a debugger 
and make it halt execution when it hits the exception, then poke around 
and examine the system state...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.