AndroidIconAnimator icon indicating copy to clipboard operation
AndroidIconAnimator copied to clipboard

App crashes on importing SVG

Open alexjlockwood opened this issue 8 years ago • 1 comments

This SVG causes the app to crash:

https://gist.github.com/alexjlockwood/0db6f64f81eb1eb54434636155463615

The error in the JS console is something like 'can't get property stroke from undefined'.

alexjlockwood avatar Feb 24 '17 23:02 alexjlockwood

To avoid the crash, I think maybe you have to change this function to:

let simpleAttr_ = (nodeAttr, contextAttr) => {
  if (node.attributes && node.attributes[nodeAttr]) {
    context[contextAttr] = node.attributes[nodeAttr].value;
  }
};

I guess it is possible for node.attributes to be undefined if no attributes are specified.

There are some other instances of node.attributes that may need to be checked too.

alexjlockwood avatar Feb 24 '17 23:02 alexjlockwood