2
0
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:
{Qingping,Dave} Hou 2012-09-30 13:26:03 -07:00
commit fcecd1425a

View File

@ -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)