Skip to content

[GREENFOOT-234] java.lang.IllegalStateException within painting after removing objects

I wrote a simple clean-function:

{noformat} /** removes every Object from the WombatWorld */ public void clean() { removeObjects(getObjects(null)); } {noformat}

when I call this function several times, I sometimes get

{noformat} Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: The actor has not been inserted into a world so it has no location yet. You might want to look at the method addedToWorld on the Actor class. at greenfoot.Actor.failIfNotInWorld(Actor.java:620) at greenfoot.Actor.getX(Actor.java:139) at greenfoot.gui.WorldCanvas.paintObjects(WorldCanvas.java:93) at greenfoot.gui.WorldCanvas.paintComponent(WorldCanvas.java:150) {noformat}

Objects should not be painted after deletion


Issue metadata

  • Issue type: Bug
  • Priority: Medium
  • Fix versions: 1.5.2