Excelsior Forums: ArrayList.iterator() failed with a NullPointerException - Excelsior Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ArrayList.iterator() failed with a NullPointerException

#1 User is offline   deiruch 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 0
  • Joined: 03-May 11

Posted 03 May 2011 - 08:09 PM

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 :)
0

#2 User is offline   zztop 

  • Advanced Member
  • Group: Moderators
  • Posts: 331
  • Joined: 09-February 05

Posted 05 May 2011 - 08:17 PM

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?

#3 User is offline   deiruch 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 0
  • Joined: 03-May 11

Posted 16 May 2011 - 02:14 PM

My fault: update() was overloaded and the exception was caused by a bug in the other method.

Sorry to bother,
Simon
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users