It is in Java, cross-platform and debugged on a computer running Ubuntu Oneric with OpenJDK installed as my runtime.
I have an EnumSet for checking inside a class in a game I'm working on. I have this read from logcat, from debugging in my constructor:
Tile : passability being set...? Exception in thread "Thread-1" javax.media.opengl.GLException:java.lang.NullPointerException ... Caused by: java.lang.NullPointerException at net.darkglass.map.Tile.addPassability(Tile.java:144) ...
Not funny. Tracking this, my problem seems to be completely, this line:
public void addPassability(Passability type) { this.passability.add(type); }
By this, I mean the body of this function. It is called from the constructor as:
this.addPassability(Passability.AIR);
When a NullPointerException error occurs. In a body like Passability Enum, I have
public enum Passability { AIR, ALL, GROUND, NONE, SIGHT, SKILL, STRUCTURE, WATER; }
literally, the entire declaration of listing listing. this.passability declared
private EnumSet <Passability> passability;
at the beginning of the class definition, and I got the impression that the add () method was inherited as part of the Java standard EnumSet definition.
Iām self-taught, but Iām not crazy. Either I have something wrong, or there is a better way to do this. Anyone who has any useful knowledge can give a hand?