Skip to content

Commit

Permalink
Merge pull request #4 from sunnylqm/patch-1
Browse files Browse the repository at this point in the history
检查points是否为空
  • Loading branch information
small-tou authored Jan 16, 2018
2 parents f1b39e2 + d09f09f commit bc12528
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parser/pathParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const pathParser = function (layer) {
return null;
}
let path = layer.path;
if(!path.points || !path.points.length) {
return null;
}
let {x, y} = getXY(path.points[0].point,layer);
let ret = `M${toS(x)},${toS(y)}`;
let n = path['isClosed'] ? path.points.length + 1 : path.points.length;
Expand Down Expand Up @@ -41,4 +44,4 @@ function getXY(s,layer) {
y = layer.frame.height * y;
return {x, y}
}
module.exports = pathParser;
module.exports = pathParser;

0 comments on commit bc12528

Please sign in to comment.