mirror of
https://github.com/koreader/koreader
synced 2024-11-04 12:00:25 +00:00
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
This commit is contained in:
parent
5c353c2289
commit
b989a6ff15
@ -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…
Reference in New Issue
Block a user