From f0c24f54acaf831c9e54ba92972c4f79675c823a Mon Sep 17 00:00:00 2001 From: rafern Date: Fri, 2 Aug 2024 09:47:46 +0100 Subject: [PATCH] Fix crash when Icon image is not loaded and dimensions are resolved --- src/widgets/Icon.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/Icon.ts b/src/widgets/Icon.ts index f0ecbe0..7553eb6 100644 --- a/src/widgets/Icon.ts +++ b/src/widgets/Icon.ts @@ -301,8 +301,8 @@ export class Icon extends Widget { case IconFit.Contain: case IconFit.Cover: { - const widthRatio = this.idealWidth / wantedWidth; - const heightRatio = this.idealHeight / wantedHeight; + const widthRatio = wantedWidth === 0 ? 0 : this.idealWidth / wantedWidth; + const heightRatio = wantedHeight === 0 ? 0 : this.idealHeight / wantedHeight; let scale; if(this.fit === IconFit.Contain) {