Skip to content

Commit

Permalink
Fix popToSceneStackLevel bug in Director
Browse files Browse the repository at this point in the history
  • Loading branch information
pandamicro committed Nov 25, 2015
1 parent b2229a5 commit a0f75b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cocos2d/core/CCDirector.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,12 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
var locScenesStack = this._scenesStack;
var c = locScenesStack.length;

if (c === 0) {
if (level === 0) {
this.end();
return;
}
// current level or lower -> nothing
if (level > c)
// stack overflow
if (level >= c)
return;

// pop stack until reaching desired level
Expand All @@ -745,7 +745,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
c--;
}
this._nextScene = locScenesStack[locScenesStack.length - 1];
this._sendCleanupToScene = false;
this._sendCleanupToScene = true;
},

/**
Expand Down

0 comments on commit a0f75b2

Please sign in to comment.