When null pointer exceptions occur you can usually bet that there is a missing
something = new....statement or you are referencing uninitialized memory, as in out of bounds on an array;
Often one can figure out the probable cause based on recent edits.