The error means that you are trying to use probably a method on an object that doesnt exist… you could just enclose whatever is trying to access the object in an if statement (or try/catch statement) testing to see if the object is null or not, failing that you could make sure that there is always an object.
p.s without the code its hard to give you specific advice