coa.17: comprehensive partial-data hardening + DataStore_Characters login scan + Skills strip cap
release / release (push) Successful in 5s
release / release (push) Successful in 5s
- Hardening sweep across DataStore_* (softened crash-asserts in Talents/Containers/Quests to graceful nil) + Altoholic frames (guarded remaining getter results). - DataStore_Characters: scan on login (was ghost-gated -> name/level/class never populated; the core 'no character data' cause). - Skills tab: cap inline professions at 6 (+N) so the strip stops overflowing into Cooking.
This commit is contained in:
@@ -234,7 +234,9 @@ local function _GetReferenceTable()
|
||||
end
|
||||
|
||||
local function _GetClassReference(class)
|
||||
assert(type(class) == "string")
|
||||
-- CoA: custom classes (MONK, BARBARIAN, …) have no vanilla reference table; return nil
|
||||
-- instead of asserting/crashing so callers can degrade gracefully.
|
||||
if type(class) ~= "string" then return end
|
||||
return addon.ref.global[class]
|
||||
end
|
||||
|
||||
@@ -251,27 +253,28 @@ local function _IsClassKnown(class)
|
||||
class = class or "" -- if by any chance nil is passed, trap it to make sure the function does not fail, but returns nil anyway
|
||||
|
||||
local ref = _GetClassReference(class)
|
||||
if ref.Order then -- if the Order field is not nil, we have data for this class
|
||||
if ref and ref.Order then -- CoA: ref is nil for custom classes; was an unguarded index crash
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function _ImportClassReference(class, data)
|
||||
assert(type(class) == "string")
|
||||
assert(type(data) == "table")
|
||||
|
||||
-- CoA: data arrives over Comm/AccountSharing; a peer with no reference for a custom
|
||||
-- class can send nil, which used to crash the import. Skip silently instead.
|
||||
if type(class) ~= "string" or type(data) ~= "table" then return end
|
||||
|
||||
addon.ref.global[class] = data
|
||||
end
|
||||
|
||||
local function _GetClassTrees(class)
|
||||
assert(type(class) == "string")
|
||||
|
||||
-- CoA: ref is nil for custom classes; guard so the `for tree in DS:GetClassTrees()`
|
||||
-- loops in Talents.lua get an empty iterator instead of an index-nil crash.
|
||||
local ref = _GetClassReference(class)
|
||||
local order = ref.Order
|
||||
local order = ref and ref.Order
|
||||
if order then
|
||||
return order:gmatch("([^,]+)")
|
||||
end
|
||||
-- to do, add a return value that does not require validity testing by the caller
|
||||
return function() return nil end -- empty iterator so callers can loop safely
|
||||
end
|
||||
|
||||
local function _GetTreeInfo(class, tree)
|
||||
@@ -284,8 +287,7 @@ end
|
||||
|
||||
local function _GetTreeNameByID(class, id)
|
||||
-- returns the name of tree "id" for a given class
|
||||
assert(type(class) == "string")
|
||||
|
||||
-- CoA: _GetClassTrees now yields an empty iterator for custom classes, so no assert needed
|
||||
local index = 1
|
||||
for name in _GetClassTrees(class) do
|
||||
if index == id then
|
||||
|
||||
Reference in New Issue
Block a user