From 4e1129709ce03bcb13c2f6a5afce87e6e1d2a80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 3 Mar 2023 22:47:00 -0800 Subject: [PATCH] Fixed exception formatting nonexistent value Co-authored-by: Martin Raifer --- modules/ui/fields/roadheight.js | 7 +++++-- modules/ui/fields/roadspeed.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/ui/fields/roadheight.js b/modules/ui/fields/roadheight.js index 696d8c119..f04bc0e97 100644 --- a/modules/ui/fields/roadheight.js +++ b/modules/ui/fields/roadheight.js @@ -175,8 +175,11 @@ export function uiFieldRoadheight(field, context) { } else if (primaryValue) { var rawValue = primaryValue; primaryValue = parseFloat(rawValue); - if (isNaN(primaryValue)) primaryValue = rawValue; - primaryValue = formatFloat(primaryValue); + if (isNaN(primaryValue)) { + primaryValue = rawValue; + } else { + primaryValue = formatFloat(primaryValue); + } _isImperial = false; } } diff --git a/modules/ui/fields/roadspeed.js b/modules/ui/fields/roadspeed.js index 25b47ea06..52799d86a 100644 --- a/modules/ui/fields/roadspeed.js +++ b/modules/ui/fields/roadspeed.js @@ -137,8 +137,11 @@ export function uiFieldRoadspeed(field, context) { } value = parseInt(value, 10); - if (isNaN(value)) value = rawValue; - value = formatFloat(value); + if (isNaN(value)) { + value = rawValue; + } else { + value = formatFloat(value); + } } setUnitSuggestions();