fix reset scrollbar null exception

This commit is contained in:
zilongshanren
2016-02-17 11:33:15 +08:00
parent bb4f2fb394
commit 3ca164fe19
+8 -4
View File
@@ -159,8 +159,10 @@ var ScrollView = cc.Class({
type: cc.Scrollbar,
tooltip: 'i18n:COMPONENT.scrollview.horizontal_bar',
notify: function() {
this.horizontalScrollBar.setTargetScrollView(this);
this._updateScrollBar(0);
if (this.horizontalScrollBar) {
this.horizontalScrollBar.setTargetScrollView(this);
this._updateScrollBar(0);
}
},
animatable: false
},
@@ -174,8 +176,10 @@ var ScrollView = cc.Class({
type: cc.Scrollbar,
tooltip: 'i18n:COMPONENT.scrollview.vertical_bar',
notify: function() {
this.verticalScrollBar.setTargetScrollView(this);
this._updateScrollBar(0);
if (this.verticalScrollBar) {
this.verticalScrollBar.setTargetScrollView(this);
this._updateScrollBar(0);
}
},
animatable: false
}