From e875aba0259f9244a36a5be4a53f4aa4fb7ef082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacy=20=C5=81=C4=85tka?= Date: Mon, 5 Aug 2024 13:06:00 +0200 Subject: [PATCH] fix pendulum example to not crash on empty mass input field (cherry picked from commit 21967b1b0d3dc7e5e0d53b08a7436069e8dd3726) --- apps/common-app/src/examples/PendulumExample.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/common-app/src/examples/PendulumExample.tsx b/apps/common-app/src/examples/PendulumExample.tsx index 279194acebc..2f651c9ab87 100644 --- a/apps/common-app/src/examples/PendulumExample.tsx +++ b/apps/common-app/src/examples/PendulumExample.tsx @@ -162,7 +162,10 @@ export default function SpringExample() { { fontSize: useConfigWithDuration ? 50 - : Math.min(0.75 * Number.parseFloat(mass), 40) + 10, + : Math.min( + 0.75 * Number.parseFloat(mass === '' ? '0' : mass), + 40 + ) + 10, }, ]}> {/* Using here view with border radius would be more natural, but views with border radius and rotation are bugged on android */}