diff --git a/src/svg/SvgExport.js b/src/svg/SvgExport.js index 672f2f8f..2c8c5b4d 100644 --- a/src/svg/SvgExport.js +++ b/src/svg/SvgExport.js @@ -304,6 +304,12 @@ new function() { var get = entry.get, type = entry.type, value = item[get](); + + // In some cases, the style's value is undefined. Trying to save it + // will result in erroneous behavior; for instance, properties like + // "fill-rule" will have the invalid value of "none" if undefined. + if (value === undefined) return; + if (entry.exportFilter ? entry.exportFilter(item, value) : !parent || !Base.equals(parent[get](), value) || diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index 9b97668b..a94fc8e2 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -531,7 +531,14 @@ new function() { if (matrix) group.transform(matrix); } - } + }, + + 'fill-rule': function(item, value) { + // Sometimes, the fill-rule attribute will be set to "none" due to a paper.js bug. + // This is coerced into a `null`. A null `fillRule` will cause certain operaions to error out. + // So, only set the fill rule if it's one of the two valid options: "evenodd" and "nonzero". + if (value === 'evenodd' || value === 'nonzero') item.fillRule = value; + } }); function getAttribute(node, name, styles) {