Skip to content

Commit

Permalink
do compat func with pcall. Extra check if version exists
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Aug 21, 2019
1 parent dcd2814 commit 006e2c8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Utils/BackwardsCompat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ addon.Compat = Compat
-- Each compat can only be run once per login, so feel free to call it again.
function Compat:Run()
for k,v in ipairs(self.list) do
if v.version == "always" or addon:VersionCompare(addon.db.global.version, v.version) and not v.executed then
if v.version == "always"
or (addon:VersionCompare(addon.db.global.version, v.version) or not addon.db.global.version)
and not v.executed then
addon:Debug("<Compat>", "Executing:", k, v.name or "no_name")
v.func(addon, addon.version, addon.db.global.version, addon.db.global.oldVersion)
local check = pcall(v.func, addon, addon.version, addon.db.global.version, addon.db.global.oldVersion)
v.executed = true
if not check then
addon:Debug("<Compat>", "<ERROR>", "Failed to execute:", v.name)
end
end
end

Expand Down

0 comments on commit 006e2c8

Please sign in to comment.