From d4fab8b165d23743dd6574e34d8372591feca54a Mon Sep 17 00:00:00 2001 From: Permok Date: Sun, 19 Mar 2023 02:32:29 +0100 Subject: [PATCH] Fix lua error that got introduced with the latest update --- ImprovedTalentLoadouts.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ImprovedTalentLoadouts.lua b/ImprovedTalentLoadouts.lua index 0a78379..e4cb17c 100644 --- a/ImprovedTalentLoadouts.lua +++ b/ImprovedTalentLoadouts.lua @@ -150,6 +150,7 @@ function TalentLoadouts:InitializeCharacterDB() self.charMacros = ImprovedTalentLoadoutsDB.actionbars.macros.char[playerName] self.globalMacros = ImprovedTalentLoadoutsDB.actionbars.macros.global self.specID = PlayerUtil.GetCurrentSpecID() + self:CheckDBIntegrity() self:CheckForVersionUpdates() self.initialized = true self:UpdateMacros() @@ -193,13 +194,16 @@ function TalentLoadouts:CheckForVersionUpdates() local currentVersion = ImprovedTalentLoadoutsDB.version ImprovedTalentLoadoutsDB.version = internalVersion - for _, categoryInfo in pairs(TalentLoadouts.globalDB.categories[self.specID]) do - if categoryInfo.parents then - local index = tIndexOf(categoryInfo.parents, categoryInfo.key) - if index then - tremove(categoryInfo.parents, index) - if #categoryInfo.parents == 0 then - categoryInfo.isSubCategory = nil + local categories = TalentLoadouts.globalDB.categories[self.specID] + if categories then + for _, categoryInfo in pairs(categories) do + if categoryInfo.parents then + local index = tIndexOf(categoryInfo.parents, categoryInfo.key) + if index then + tremove(categoryInfo.parents, index) + if #categoryInfo.parents == 0 then + categoryInfo.isSubCategory = nil + end end end end