diff --git a/cocos2d/core/components/CCPageView.js b/cocos2d/core/components/CCPageView.js index 79700f450f..947e9ab73b 100644 --- a/cocos2d/core/components/CCPageView.js +++ b/cocos2d/core/components/CCPageView.js @@ -369,7 +369,7 @@ var PageView = cc.Class({ * @param {Number} timeInSecond scrolling time */ scrollToPage: function (idx, timeInSecond) { - if (idx < 0 || idx > this._pages.length) + if (idx < 0 || idx >= this._pages.length) return; timeInSecond = timeInSecond !== undefined ? timeInSecond : 0.3; this._curPageIdx = idx;