Skip to content

Commit

Permalink
Do not crash when user provided something that is not an url as icon
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Nov 15, 2024
1 parent 294d712 commit cf0841a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import memoize from "memoizee";
import type { OverridableComponent } from "@mui/material/OverridableComponent";
import type { SvgIconTypeMap } from "@mui/material/SvgIcon";
import { assert } from "tsafe/assert";
import CropSquareIcon from "@mui/icons-material/CropSquare";

/**
*
Expand Down Expand Up @@ -108,7 +109,9 @@ export const Icon = memo(
return createLazySvg(icon);
}

throw new Error(`${icon} is not an url`);
console.warn(`'${icon}' is not an url`);

return CropSquareIcon;
})();

return (
Expand Down

0 comments on commit cf0841a

Please sign in to comment.