Skip to content
Snippets Groups Projects
Commit 0dc1ee91 authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix "Cannot read property 'attrs' of undefined" when icon is missing

parent fd2720c5
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,9 @@ export default class Icon extends Component {
render() {
const icon = loadIcon(this.props.name);
if (!icon) {
return null;
}
const props = { ...icon.attrs, ...this.props };
if (props.size != null) {
......@@ -31,9 +34,7 @@ export default class Icon extends Component {
props.height *= props.scale;
}
if (!icon) {
return <span className="hide" />;
} else if (icon.img) {
if (icon.img) {
return (<RetinaImage forceOriginalDimensions={false} {...props} src={icon.img} />);
} else if (icon.svg) {
return (<svg {...props} dangerouslySetInnerHTML={{__html: icon.svg}}></svg>);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment