Please post the full text of the error message. It gives the location of the error.
A NPE is because the code tries to use a variable with a null value to reference an object. You need to find what...