You’re saying you didn’t get a better debug message/log output? I was hoping you’d be able to narrow in on the source line.
Consider that you might have left a timer running after changing scenes and or destroying an object the timer is operating on.
I’d look at each timer I start and ask myself this question:
"Is the code activated by the timer operating on an object that could be deleted before the timer fires. "
If, “Yes,” then continue…
For each of these cases, either:
A. Cancel the timer when you remove the dependent object(s).
B. Put in safety code:
These are NOT SAFE:
-- Both examples will crash -- Version 1 - Manipulating object via timed closure -- local obj = display.newCircle( 10, 10, 10) timer.performWithDelay( 500, function() obj.x = obj.x + 10 end ) display.remove(obj) -- Version 2 - Manipulating object via timed local function -- local obj2 = display.newCircle( 10, 10, 10) function obj2.timer( self ) self.x = self.x + 10 end timer.performWithDelay( 500, obj2 ) display.remove(obj)
These are SAFE:
-- Both examples will abort early and safely -- Version 1 - Manipulating object via timed closure -- local obj = display.newCircle( 10, 10, 10) timer.performWithDelay( 500, function() if( obj.removeSelf == nil ) then return end obj.x = obj.x + 10 end ) display.remove(obj) -- Version 2 - Manipulating object via timed local function -- local obj2 = display.newCircle( 10, 10, 10) function obj2.timer( self ) if( self.removeSelf == nil ) then return end self.x = self.x + 10 end timer.performWithDelay( 500, obj2 ) display.remove(obj)