CCScheduler issue

at CCScheduler.cpp line number 823,
has a comment:“// The ‘timers’ array may change while inside this loop”,
I found the timers was NULL sometimes , but I don’t know why ? and why not fix it by :

replace

for (elt~~>timerIndex = 0; elt~~>timerIndex < elt~~>timers~~>num; ++(elt->timerIndex))

to:

for (elt~~>timerIndex = 0; elt~~>timers && elt~~>timerIndex < elt~~>timers->num; ++(elt->timerIndex))

?

Same issue here… kept crashing on Release Build. I added another condition. Hope this can be more stable.

Version: cocos2d-x-2.2 C++
Github: https://github.com/cocos2d/cocos2d-x/blob/master/cocos2dx/CCScheduler.cpp#L831

original

for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex))

modified

for (elt->timerIndex = 0; elt && elt->timers && elt->timerIndex < elt->timers->num; ++(elt->timerIndex))

These posts are easier to deal with if a version ID or GIT link is provided.