Skip to content

Commit cce4e89

Browse files
committed
Add safeguards to SVG loading implementation
1 parent 5e7573b commit cce4e89

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ private static ImageSource LoadSvgImage(string path, bool loadFullImage = false)
391391

392392
// Calculate scale to achieve desired height
393393
var drawingBounds = drawing.Bounds;
394+
if (drawingBounds.Height <= 0)
395+
{
396+
throw new InvalidOperationException($"Invalid SVG dimensions: Height must be greater than zero in {path}");
397+
}
394398
var scale = desiredHeight / drawingBounds.Height;
395399
var scaledWidth = drawingBounds.Width * scale;
396400
var scaledHeight = drawingBounds.Height * scale;

0 commit comments

Comments
 (0)