diff --git a/lib/context2d.js b/lib/context2d.js index ef3b6a7..4d82c76 100644 --- a/lib/context2d.js +++ b/lib/context2d.js @@ -165,6 +165,7 @@ Context2d.prototype.setTransform = function(){ */ Context2d.prototype.__defineSetter__('fillStyle', function(val){ + if (!val) return; if ('CanvasGradient' == val.constructor.name || 'CanvasPattern' == val.constructor.name) { this.lastFillStyle = val; @@ -192,6 +193,7 @@ Context2d.prototype.__defineGetter__('fillStyle', function(){ */ Context2d.prototype.__defineSetter__('strokeStyle', function(val){ + if (!val) return; if ('CanvasGradient' == val.constructor.name || 'CanvasPattern' == val.constructor.name) { this.lastStrokeStyle = val; @@ -221,6 +223,7 @@ Context2d.prototype.__defineGetter__('strokeStyle', function(){ */ Context2d.prototype.__defineSetter__('font', function(val){ + if (!val) return; if ('string' == typeof val) { var font; if (font = parseFont(val)) { @@ -252,6 +255,7 @@ Context2d.prototype.__defineGetter__('font', function(){ */ Context2d.prototype.__defineSetter__('textBaseline', function(val){ + if (!val) return; var n = baselines.indexOf(val); if (~n) { this.lastBaseline = val;