From e787336fc4ecb6cd890835e5c30fd327d1e5244f Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 27 Feb 2021 22:43:18 +0100 Subject: [PATCH] fix empty input --- htdocs/lib/settings/FrequencyInput.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/lib/settings/FrequencyInput.js b/htdocs/lib/settings/FrequencyInput.js index 81fdef4..dbc978e 100644 --- a/htdocs/lib/settings/FrequencyInput.js +++ b/htdocs/lib/settings/FrequencyInput.js @@ -30,7 +30,10 @@ $.fn.frequencyInput = function() { $exponent.on('change', setExponent); // calculate initial exponent - $exponent.val(Math.floor(Math.log10($input.val()) / 3) * 3); - setExponent(); + var value = parseFloat($input.val()); + if (!Number.isNaN(value)) { + $exponent.val(Math.floor(Math.log10(value) / 3) * 3); + setExponent(); + } }) }; \ No newline at end of file