Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tough-balloons-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'feather-icons': patch
---

Feather no longer breaks when trying to replace an icon using an invalid name
5 changes: 5 additions & 0 deletions src/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ function replaceElement(element, attrs = {}) {
const name = elementAttrs['data-feather'];
delete elementAttrs['data-feather'];

if (icons[name] === undefined) {
console.warn(`feather: '${name}' is not a valid icon`);
return;
}

const svgString = icons[name].toSvg({
...attrs,
...elementAttrs,
Expand Down