diff --git a/DataStore_Reputations/DataStore_Reputations.lua b/DataStore_Reputations/DataStore_Reputations.lua index a1f7570..1dd11db 100644 --- a/DataStore_Reputations/DataStore_Reputations.lua +++ b/DataStore_Reputations/DataStore_Reputations.lua @@ -66,17 +66,20 @@ do local function AddFaction(id, text) text = text or API_GetFactionNameByID(id) + + -- a faction that does not exist in this version of the game has no name here. + -- Registering it anyway would index factionNameToId with nil, which errors out of this + -- whole block and leaves every faction declared below it unregistered. + if not text then return end + factions[id] = text - - if not text then - print("no value for id : " .. id) - -- else print("Added", id, text) --debug - end factionNameToId[text] = id end local function RemoveFaction(id) - factionNameToId[factions[id]] = nil - factions[id] = nil + if factions[id] then + factionNameToId[factions[id]] = nil + factions[id] = nil + end end AddFaction(21, BF["Booty Bay"]) diff --git a/DataStore_Reputations/DataStore_Reputations_Vanilla.toc b/DataStore_Reputations/DataStore_Reputations_Vanilla.toc index b0bbdaf..88be79f 100644 --- a/DataStore_Reputations/DataStore_Reputations_Vanilla.toc +++ b/DataStore_Reputations/DataStore_Reputations_Vanilla.toc @@ -7,7 +7,7 @@ ## Version: 2026.07.10 ## Dependencies: DataStore ## OptionalDeps: Ace3 -## SavedVariables: DataStore_ReputationsDB +## SavedVariables: DataStore_Reputations_Characters ## X-Category: Interface Enhancements ## X-Embeds: Ace3