KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is in Java, cross platform and being debugged on a computer running Ubuntu Oneric with OpenJDK installed as my runtime. I have an EnumSet for checking inside of in a class in a game I'm working on. I have this readout from logcat, from debug aplenty 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 amusing. Tracking it down, my problem seems to be, entirely, this line: public void addPassability(Passability type) { this.passability.add(type); } By which I mean the body of that function. It is called from the constructor as: this.addPassability(Passability.AIR); When the NullPointerException happens. In the body of the Passability Enum Type, I have public enum Passability { AIR, ALL, GROUND, NONE, SIGHT, SKILL, STRUCTURE, WATER; } as, quite literally, the entire enum save package declaration. this.passability is declared private EnumSet <Passability> passability; at the beginning of the class definition and I was under the impression that the add() method was inherited as part of the definition of EnumSet in the Java Standard. I'm self-taught, but I'm not crazy. Either I've got something wrong or there's a better way to do this. Anyone with some useful knowledge out there able to lend a hand?
Tags (comma-separated)
Save Edits
Cancel