1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2025-04-24 10:11:05 +00:00

Made text inputs never give NaNs

This commit is contained in:
Harley White 2021-05-18 18:36:17 -04:00
parent bb0926c17d
commit 23cbfc7a9e
4 changed files with 11 additions and 5 deletions

View file

@ -334,10 +334,13 @@ document.title = modInfo.name
// Converts a string value to whatever it's supposed to be
function toValue(value, oldValue) {
if (oldValue instanceof Decimal)
return new Decimal (value)
if (oldValue instanceof Decimal) {
value = new Decimal (value)
if (value.eq(decimalNaN)) return decimalZero
return value
}
if (!isNaN(oldValue))
return parseFloat(value)
return parseFloat(value) || 0
return value
}