Restrict the values of rcountmax to the range 0-10

Currently the user can enter any value like -10 and it is accepted and
saved in the settings file(s).
This commit is contained in:
Tigran Aivazian
2012-09-30 16:06:55 +01:00
parent 72b064fa9a
commit 79c1dd44ca

View File

@@ -2490,7 +2490,7 @@ function UniReader:addAllCommands()
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)
self.rcountmax = math.min(self.rcountmax, 10)
-- storing this parameter in both global and local settings
G_reader_settings:saveSetting("rcountmax", self.rcountmax)
self.settings:saveSetting("rcountmax", self.rcountmax)