Skip to content

Commit

Permalink
Ensure element exists when setting fill-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
mudcube committed Jul 11, 2018
1 parent 85cd5a1 commit 015ba10
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions canvas2svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,12 @@
*/
ctx.prototype.fill = function () {
var element = getOrCreateElementToApplyStyleTo.call(this, "fill", "stroke");

/** `fillRule` could be first or second argument: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fill **/
if (arguments[0] === "evenodd" || arguments[1] === "evenodd") {
element.setAttribute("fill-rule", "evenodd");
}
if (element) {
/** `fillRule` could be first or second argument: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fill **/
if (arguments[0] === "evenodd" || arguments[1] === "evenodd") {
element.setAttribute("fill-rule", "evenodd");
}
}
};

/**
Expand Down

0 comments on commit 015ba10

Please sign in to comment.