some code should be helpfull.
i got this kind of error usually when i load images 'on the fly', anyway is related to wrong memory access, check if you attempt to write in a nil variable