reply to NullPointerException
By davmac - about 3 hours ago
You haven't posted all the class code, so I can't see which line is line 27 (the line the exception happens on). That makes it harder to help you. However I can see some problems with your code:
- You call 'getWorld()' after removing 'this' from the world in several places. Once 'this' has been removed from the world, getWorld() will return null. You can fix it by checking that getWorld() is not null before you try to use it - if (getWorld() != null) ...
- On line 19 you cast the world to a 'Contador' and then try to get objects inside it which are of class 'Contador'. That doesn't make sense. If Contador is a world class, then the world cannot contain Contador objects.