Skip to content

Commit

Permalink
fix(version): report unknown versions during checkDependency
Browse files Browse the repository at this point in the history
Rather than throwing potentially fatal and confusing errors we should
just report the current version as 'unknown'.
  • Loading branch information
thelindat committed Jun 12, 2023
1 parent 7816ce7 commit 1f76590
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resource/version/shared.lua
Original file line number Diff line number Diff line change
@@ -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) }
Expand All @@ -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
Expand Down

0 comments on commit 1f76590

Please sign in to comment.