Fix bug in CompoundPath#draw(ctx, draw) which was causing an error when a compound path didn't have any children.

This commit is contained in:
Jonathan Puckey 2011-07-25 21:41:09 +02:00
parent 43cc8e45b2
commit 63628be923

View file

@ -85,10 +85,15 @@ var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath#
},
draw: function(ctx, param) {
var l = this._children.length;
// Return early if the compound path doesn't have any children:
if (l == 0) {
return;
}
var firstChild = this._children[0];
ctx.beginPath();
param.compound = true;
for (var i = 0, l = this._children.length; i < l; i++)
for (var i = 0; i < l; i++)
Item.draw(this._children[i], ctx, param);
firstChild._setStyles(ctx);
var fillColor = firstChild.getFillColor(),