Avoid error when SVG path data does not contain any 'm' commands.

Fixes #529
This commit is contained in:
Jürg Lehni 2014-09-22 17:44:15 +02:00
parent ee27fe820f
commit 48e9447c47

View file

@ -133,7 +133,7 @@ new function() {
param = { pathData: data };
// If there are multiple moveTo commands or a closePath command followed
// by other commands, we have a CompoundPath:
return data.match(/m/gi).length > 1 || /z\S+/i.test(data)
return (data.match(/m/gi) || []).length > 1 || /z\S+/i.test(data)
? new CompoundPath(param)
: new Path(param);
}