mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[hotfix] tonumber makes an empty string nil
This commit is contained in:
@@ -29,9 +29,9 @@ function Version:getNormalizedVersion(rev)
|
||||
if not rev then return end
|
||||
local year, month, revision = rev:match("v(%d%d%d%d)%.(%d%d)-?(%d*)")
|
||||
|
||||
if type(year) ~= "number" then revision = 0 end
|
||||
if type(month) ~= "number" then revision = 0 end
|
||||
if type(revision) ~= "number" then revision = 0 end
|
||||
year = tonumber(year)
|
||||
month = tonumber(month)
|
||||
revision = tonumber(revision)
|
||||
|
||||
local commit = rev:match("-%d*-g(%x*)[%d_%-]*")
|
||||
-- NOTE: * 10000 to handle at most 9999 commits since last tag ;).
|
||||
|
||||
Reference in New Issue
Block a user