In most cases when something like this happens, the object this code runs on, i.e. the object for which the surrounding method is called, is not valid (anymore).

Cheers,
_