Skip to content

Commit

Permalink
fix: add empty svg crashed the process
Browse files Browse the repository at this point in the history
  • Loading branch information
Jevon617 committed Nov 27, 2024
1 parent 9c0d313 commit 946f20b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export async function addSymbol(

async function optimizeSvg(source: string, preserveColor: boolean, optimizeOptions?: OptimizeOptions) {
const { data: optimizedSvgContent } = await optimize(source, optimizeOptions) as OptimizedSvg
if (!optimizedSvgContent) {
const emptySvgContent = '<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"></svg>'
return emptySvgContent
}
return preserveColor
? optimizedSvgContent
: optimizedSvgContent
Expand Down

0 comments on commit 946f20b

Please sign in to comment.