fix: pcall-guard C_ClassInfo.GetSpecInfo to silence CoA spec API spam

On the current CoA Beta client, C_ClassInfo.GetAllSpecs(class) returns
items that GetSpecInfo cannot accept as arg #2, throwing
'Script::ValidateInput Invalid argument type at index 2. Expected string.'
~150 times per session across DF, LibOpenRaid, gears, profiles, etc.

Wrap every unguarded GetSpecInfo(class, spec) site in pcall + nil-guard
so the iteration skips bad entries silently. Matches the pattern already
used by CoaExporter and prevents Error.txt flooding.
This commit is contained in:
2026-05-23 00:14:25 +02:00
parent 9c204f6763
commit 02b17e0a00
7 changed files with 24 additions and 8 deletions
+6 -2
View File
@@ -4252,9 +4252,11 @@ for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
specs_per_class[class] = {} specs_per_class[class] = {}
for index, spec in ipairs(specs) do for index, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo then
specs_per_class[index] = specInfo.ID specs_per_class[index] = specInfo.ID
end end
end
end end
---return an array table with the spec ids the class can have ---return an array table with the spec ids the class can have
@@ -4565,10 +4567,12 @@ for _, class in ipairs(CLASS_SORT_ORDER) do
DF.ClassSpecs[class] = {} DF.ClassSpecs[class] = {}
DF.SpecListByClass[class] = {} DF.SpecListByClass[class] = {}
for index, spec in ipairs(specs) do for index, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo then
DF.ClassSpecs[class][specInfo.ID] = true DF.ClassSpecs[class][specInfo.ID] = true
tinsert(DF.SpecListByClass[class], specInfo.ID) tinsert(DF.SpecListByClass[class], specInfo.ID)
end end
end
end end
---return if the specId is a valid spec, it'll return false for specIds from the tutorial area ---return if the specId is a valid spec, it'll return false for specIds from the tutorial area
+3 -1
View File
@@ -81,9 +81,11 @@ for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
DF.ClassSpecIds[class] = {} DF.ClassSpecIds[class] = {}
for _, spec in ipairs(specs) do for _, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo and specInfo.ID then
DF.SpecIds[specInfo.ID] = class DF.SpecIds[specInfo.ID] = class
DF.ClassSpecIds[specInfo.ID] = true DF.ClassSpecIds[specInfo.ID] = true
end
end end
end end
+3 -1
View File
@@ -484,7 +484,9 @@ for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
openRaidLib.specAttribute[class] = {} openRaidLib.specAttribute[class] = {}
for index, spec in ipairs(specs) do for index, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo then
openRaidLib.specAttribute[class][specInfo.ID] = Enum.PrimaryStat[specInfo.PrimaryStats[1] or "Strength"] openRaidLib.specAttribute[class][specInfo.ID] = Enum.PrimaryStat[specInfo.PrimaryStats[1] or "Strength"]
end end
end
end end
@@ -150,11 +150,13 @@ LIB_OPEN_RAID_MELEE_SPECS = {}
for _, class in ipairs(CLASS_SORT_ORDER) do for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
for _, spec in ipairs(specs) do for _, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo then
if specInfo.MeleeDPS then if specInfo.MeleeDPS then
LIB_OPEN_RAID_MELEE_SPECS[specInfo.ID] = class LIB_OPEN_RAID_MELEE_SPECS[specInfo.ID] = class
end end
end end
end
end end
--tells the duration, requirements and cooldown --tells the duration, requirements and cooldown
+3 -1
View File
@@ -2705,7 +2705,8 @@ Details.specToTexture = {}
for _, class in ipairs(CLASS_SORT_ORDER) do for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
for _, spec in ipairs(specs) do for _, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo then
local thumbnail local thumbnail
if ClassTalentUtil then if ClassTalentUtil then
thumbnail = ClassTalentUtil.GetThumbnailAtlas(class, spec) thumbnail = ClassTalentUtil.GetThumbnailAtlas(class, spec)
@@ -2717,6 +2718,7 @@ for _, class in ipairs(CLASS_SORT_ORDER) do
Details.textureToSpec[thumbnail] = specInfo.ID Details.textureToSpec[thumbnail] = specInfo.ID
Details.specToTexture[specInfo.ID] = thumbnail Details.specToTexture[specInfo.ID] = thumbnail
end end
end
end end
--oldschool talent tree --oldschool talent tree
+3 -1
View File
@@ -962,11 +962,13 @@ for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
if specs then if specs then
for _, spec in ipairs(specs) do for _, spec in ipairs(specs) do
local spec_info = C_ClassInfo.GetSpecInfo(class, spec) local ok, spec_info = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and spec_info then
if spec_info then if spec_info then
default_profile.class_specs_coords [spec_info.ID] = {AtlasUtil:GetCoords("specicon-"..class.."-"..spec_info.Spec)} default_profile.class_specs_coords [spec_info.ID] = {AtlasUtil:GetCoords("specicon-"..class.."-"..spec_info.Spec)}
end end
end end
end
end end
end end
+3 -1
View File
@@ -18,9 +18,11 @@ do
for _, class in ipairs(CLASS_SORT_ORDER) do for _, class in ipairs(CLASS_SORT_ORDER) do
local specs = C_ClassInfo.GetAllSpecs(class) local specs = C_ClassInfo.GetAllSpecs(class)
for index, spec in ipairs(specs) do for index, spec in ipairs(specs) do
local specInfo = C_ClassInfo.GetSpecInfo(class, spec) local ok, specInfo = pcall(C_ClassInfo.GetSpecInfo, class, spec)
if ok and specInfo then
_detalhes.SpecIDToClass[specInfo.ID] = class _detalhes.SpecIDToClass[specInfo.ID] = class
end end
end
end end