Commit 80d7676f authored by Don Gagne's avatar Don Gagne

Correct check for bad value from parseFloat

parent 7af2d5a9
......@@ -138,11 +138,11 @@ SetupPage {
onClicked: {
var measuredVoltageValue = parseFloat(measuredVoltage.text)
if (measuredVoltageValue == 0) {
if (measuredVoltageValue == 0 || isNaN(measuredVoltageValue)) {
return
}
var newVoltageMultiplier = (measuredVoltageValue * battVoltMult.value) / controller.vehicle.battery.voltage.value
if (newVoltageMultiplier != 0) {
if (newVoltageMultiplier > 0) {
battVoltMult.value = newVoltageMultiplier
}
}
......
......@@ -144,11 +144,11 @@ SetupPage {
onClicked: {
var measuredVoltageValue = parseFloat(measuredVoltage.text)
if (measuredVoltageValue == 0) {
if (measuredVoltageValue == 0 || isNaN(measuredVoltageValue)) {
return
}
var newVoltageDivider = (measuredVoltageValue * battVoltageDivider.value) / controller.vehicle.battery.voltage.value
if (newVoltageDivider != 0) {
if (newVoltageDivider > 0) {
battVoltageDivider.value = newVoltageDivider
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment