SwitchSwitch.lua:61: table index is nil
Hayato2846 opened this issue ยท 1 comments
Hey!
Well, I still got the same error mentioned in the closed Issue. It seems like the functions EnsureTablentSpecTableExits and GetCurrentProfilesTable were called while in a Loading Screen and Player Spec Info returns nil. I changed this by myself in your functions so that they're a little bit more robust.
Would be super cool if you can check it out :)
function addon:EnsureTablentSpecTableExits()
local playerClass = select(3, UnitClass("player"));
local playerSpec = select(1,GetSpecializationInfo(GetSpecialization()));
addon:EnsureTalentClassTableExits()
if (playerClass and playerSpec) then
if(addon.sv.Talents.Profiles[playerClass][playerSpec] == nil) then
addon.sv.Talents.Profiles[playerClass][playerSpec] = {}
end
end
end
function addon:GetCurrentProfilesTable()
local playerClass = select(3, UnitClass("player"));
local playerSpec = select(1,GetSpecializationInfo(GetSpecialization()));
local playerTable = {}
addon:EnsureTablentSpecTableExits()
if (playerClass and playerSpec) then
playerTable = addon.sv.Talents.Profiles[playerClass][playerSpec];
end
return playerTable
end
Thanks in advance!