From 1f76590b53574d0e3b00be6917aba9027d38e930 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 13 Jun 2023 00:36:17 +1000 Subject: [PATCH] fix(version): report unknown versions during checkDependency Rather than throwing potentially fatal and confusing errors we should just report the current version as 'unknown'. --- resource/version/shared.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resource/version/shared.lua b/resource/version/shared.lua index db31854..737b3c4 100644 --- a/resource/version/shared.lua +++ b/resource/version/shared.lua @@ -1,5 +1,6 @@ function lib.checkDependency(resource, minimumVersion, printMessage) - local currentVersion = GetResourceMetadata(resource, 'version', 0):match('%d+%.%d+%.%d+') + local currentVersion = GetResourceMetadata(resource, 'version', 0) + currentVersion = currentVersion and currentVersion:match('%d+%.%d+%.%d+') or 'unknown' if currentVersion ~= minimumVersion then local cv = { string.strsplit('.', currentVersion) } @@ -10,7 +11,7 @@ function lib.checkDependency(resource, minimumVersion, printMessage) local current, minimum = tonumber(cv[i]), tonumber(mv[i]) if current ~= minimum then - if current < minimum then + if not current or current < minimum then if printMessage then return print(msg) end