Jump to content
Excelsior Forums
deiruch

ArrayList.iterator() failed with a NullPointerException

Recommended Posts

Hello everyone

another (anonymous) player has sent us a stacktrace of a crash:

java.lang.NullPointerException
at java.util.AbstractList$Itr.hasNext(AbstractList$Itr.class:0)
at net.gewaltig.cultris.gui.OpenGLGUI.update(OpenGLGUI.java:190)
at net.gewaltig.cultris.tools.UpdateManager.update(UpdateManager.java:63)
at net.gewaltig.cultris.Cultris.main(Cultris.class:98)

and here's the relevant method:

  public boolean update(float _dt) throws Exception
 {
   if(Display.isCloseRequested())
     return true;

   Iterator<CMenu> it=menus.iterator();
   while(it.hasNext())
   {
     CMenu cur=it.next();
     if(cur.fade==0 && cur.fadeV==0)
     {
       it.remove();
       cur.deinit();
     }
   }
 }

The user ran this on a quad-core machine under Windows 7 x86, again with plenty of free memory. The relevant list (menu) is an ArrayList and is never ever accessed by any other thread. "cur.deinit()" does not modify the menu ArrayList. How can this break?

Cheers,

Simon

By the way: I'd enjoy reading new blog posts :)

Share this post


Link to post
Share on other sites

Unfortunately, we cannot reason about a program by a code snippet. Can you send us a compilable example (or the entire application) to reproduce the problem on our end?

BTW, have you tried to run the application on a quad-core machine with Sun-Oracle JRE and reproduce the issue?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×