mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Merge pull request #344 from tigran123/master
Restrict the values of rcountmax to the range 0 to 10.
This commit is contained in:
commit
fcecd1425a
@ -2487,10 +2487,13 @@ function UniReader:addAllCommands()
|
||||
local count = NumInputBox:input(G_height-100, 100,
|
||||
"Full refresh after:", self.rcountmax, true)
|
||||
-- convert string to number
|
||||
if pcall(function () count = count + 0 end) then
|
||||
-- restrict self.rcountmax in reasonable range
|
||||
self.rcountmax = math.max(count, 0)
|
||||
self.rcountmax = math.min(count, 10)
|
||||
if pcall(function () count = math.floor(count) end) then
|
||||
if count < 0 then
|
||||
count = 0
|
||||
elseif count > 10 then
|
||||
count = 10
|
||||
end
|
||||
self.rcountmax = count
|
||||
-- storing this parameter in both global and local settings
|
||||
G_reader_settings:saveSetting("rcountmax", self.rcountmax)
|
||||
self.settings:saveSetting("rcountmax", self.rcountmax)
|
||||
|
Loading…
Reference in New Issue
Block a user