I think that when someone asks an incredibly open ended question like "Why is my code crashing?", it's equally fine to answer with an open ended answer giving instructions on how to debug. But that doesn't really help anyone, we end up with a low value answer on a low value question.
For review purposes, this is an answer but not a good quality one (you do have to watch out for low rep users posting answers that should be comments but they have insufficient rep to be able to comment - this is not one of those). The appropriate thing to do is to down vote it. The question is not particularly good either - there is next to no details of the exception, and there is a fair chance that the supplied code has nothing to do with it (and the supplied code cannot be run in isolation).
Unless the problem is obvious from the posted code, this question should be closed as Off topic:

until the OP can isolate the problem a little more and post a more detailed and exact question.