Skip to content

Commit

Permalink
only register event when content is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
zilongshanren committed Aug 16, 2016
1 parent 2928608 commit 2e319a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cocos2d/core/components/CCScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,9 @@ var ScrollView = cc.Class({
this._calculateBoundary();
//Because widget component will adjust content position and scrollview position is correct after visit
//So this event could make sure the content is on the correct position after loading.
cc.director.once(cc.Director.EVENT_AFTER_VISIT, this._adjustContentOutOfBoundary, this);
if(this.content) {
cc.director.once(cc.Director.EVENT_AFTER_VISIT, this._adjustContentOutOfBoundary, this);
}
},

onDestroy: function() {
Expand Down

0 comments on commit 2e319a3

Please sign in to comment.