Skip to content

Commit db90228

Browse files
committed
Fixed a bug of cc.LayerGradient that it doesn't work when constructor parameter is null.
1 parent 96e999e commit db90228

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cocos2d/core/layers/CCLayer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,10 @@ cc.LayerGradient = cc.LayerColor.extend(/** @lends cc.LayerGradient# */{
349349

350350
if(stops && stops instanceof Array){
351351
this._colorStops = stops;
352-
stops.splice(0, 0, {p:0, color: start});
353-
stops.push({p:1, color: end});
352+
stops.splice(0, 0, {p:0, color: start || cc.color.BLACK});
353+
stops.push({p:1, color: end || cc.color.BLACK});
354354
} else
355-
this._colorStops = [{p:0, color: start}, {p:1, color: end}];
355+
this._colorStops = [{p:0, color: start || cc.color.BLACK}, {p:1, color: end || cc.color.BLACK}];
356356

357357
cc.LayerGradient.prototype.init.call(this, start, end, v, stops);
358358
},

0 commit comments

Comments
 (0)