Skip to content

Commit

Permalink
Fix crash when Icon image is not loaded and dimensions are resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
rafern committed Aug 2, 2024
1 parent 242bcf1 commit f0c24f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/widgets/Icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f0c24f5

Please sign in to comment.