Skip to content

Commit

Permalink
fix: if layout width is NaN, avoid throwing (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored May 1, 2024
1 parent c14f713 commit 54c326b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/ui/app/src/components/FernImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ function getDimensions(
): { width: number; height: number } {
layoutWidth = typeof layoutWidth === "string" ? parseInt(layoutWidth, 10) : layoutWidth;
layoutHeight = typeof layoutHeight === "string" ? parseInt(layoutHeight, 10) : layoutHeight;
if (layoutWidth != null && isNaN(layoutWidth)) {
layoutWidth = undefined;
}
if (layoutHeight != null && isNaN(layoutHeight)) {
layoutHeight = undefined;
}
if (layoutWidth != null && layoutHeight != null) {
return { width: layoutWidth, height: layoutHeight };
}
Expand Down

0 comments on commit 54c326b

Please sign in to comment.