This site requires JavaScript, please enable it in your browser!
Greenfoot back
ddvink
ddvink wrote ...

2013/10/26

IllegalStateException

ddvink ddvink

2013/10/26

#
I've created a list to fill it with objects in my screen. After some time playing I get this message: java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed. at greenfoot.Actor.failIfNotInWorld(Actor.java:663) at greenfoot.Actor.getObjectsInRange(Actor.java:882) at RibbonPig.checkPlatForm(RibbonPig.java:60) at RibbonPig.act(RibbonPig.java:55) at greenfoot.core.Simulation.actActor(Simulation.java:568) at greenfoot.core.Simulation.runOneLoop(Simulation.java:526) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) How can I catch this up? Yours, Dennis de Vink
Gevater_Tod4711 Gevater_Tod4711

2013/10/26

#
You are calling the getObjectsInRange method while your actor is not in the world anymore. You can either check if getWorld() is not null before executing this or make shure that the actor still is in the world.
davmac davmac

2013/10/26

#
If you need it, there's a more complete explanation here.
ddvink ddvink

2013/10/26

#
Thanx peeps
You need to login to post a reply.