Fixed tilemaptest crashes when click 'next' button quickly

This commit is contained in:
James Chen 2014-04-21 22:24:44 +08:00
parent 2037c2e232
commit 8038d3daa5
1 changed files with 7 additions and 0 deletions

View File

@ -663,6 +663,13 @@ void Director::replaceScene(Scene *scene)
{
CCASSERT(_runningScene, "Use runWithScene: instead to start the director");
CCASSERT(scene != nullptr, "the scene should not be null");
if (_nextScene)
{
_nextScene->onExit();
_nextScene->cleanup();
_nextScene = nullptr;
}
ssize_t index = _scenesStack.size();