NaturalLightWidget: Fallback to previous values instead of `nil` (#10425)

Happens in case the InputText field is emptied by the user.
The backend code makes rather strong assumptions that it'll *always* get a number of of it ;).

Fix #10352
reviewable/pr10434/r1
NiLuJe 12 months ago committed by GitHub
parent 5c353c2289
commit b989a6ff15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -115,6 +115,13 @@ function NaturalLightWidget:adaptableNumber(initial, step)
table.insert(minus_number_plus, button_minus)
table.insert(minus_number_plus, input_text)
table.insert(minus_number_plus, button_plus)
-- Sanitize the returned value so as not to upset sysfs_light...
function input_text:getText()
-- Also, while we're here, make sure we actually return a number, because InputText doesn't for... reasons.
return tonumber(self.text) or initial
end
return minus_number_plus
end

Loading…
Cancel
Save