[hotfix] tonumber makes an empty string nil

This commit is contained in:
Frans de Jonge
2018-11-01 11:54:29 +01:00
parent bdb81c72f1
commit e636a0b231

View File

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