Skip to content

Commit 1bf1aa9

Browse files
committed
Avoid crashing when adding emotions to unknown jewel base
1 parent 49df43a commit 1bf1aa9

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,32 +3044,31 @@ function ItemsTabClass:AddCustomModifierToDisplayItem()
30443044
break
30453045
end
30463046
end
3047-
if not baseColour then
3048-
error("Base is a gem but has no colour. Base name: " .. tostring(self.displayItem.baseName))
3049-
end
3050-
for _, emotion in pairs(data.emotions) do
3051-
if emotion.radiusJewel == radiusJewel then
3052-
for modType, modId in pairs(emotion.mods[baseColour] or {}) do
3053-
local mod = data.itemMods.Jewel[modId]
3054-
if mod then
3055-
t_insert(modList, {
3056-
label = string.format("%s ^8[%s] (%s)", emotion.name, table.concat(mod, "/"),
3057-
mod.type or ""),
3058-
mod = mod,
3059-
type = "custom",
3060-
emotion = emotion,
3061-
})
3047+
if baseColour then
3048+
for _, emotion in pairs(data.emotions) do
3049+
if emotion.radiusJewel == radiusJewel then
3050+
for modType, modId in pairs(emotion.mods[baseColour] or {}) do
3051+
local mod = data.itemMods.Jewel[modId]
3052+
if mod then
3053+
t_insert(modList, {
3054+
label = string.format("%s ^8[%s] (%s)", emotion.name, table.concat(mod, "/"),
3055+
mod.type or ""),
3056+
mod = mod,
3057+
type = "custom",
3058+
emotion = emotion,
3059+
})
3060+
end
30623061
end
30633062
end
30643063
end
3064+
table.sort(modList, function(a, b)
3065+
if a.emotion.tierLevel ~= b.emotion.tierLevel then
3066+
return a.emotion.tierLevel > b.emotion.tierLevel
3067+
else
3068+
return a.emotion.name > b.emotion.name
3069+
end
3070+
end)
30653071
end
3066-
table.sort(modList, function(a, b)
3067-
if a.emotion.tierLevel ~= b.emotion.tierLevel then
3068-
return a.emotion.tierLevel > b.emotion.tierLevel
3069-
else
3070-
return a.emotion.name > b.emotion.name
3071-
end
3072-
end)
30733072
elseif sourceId == "DESECRATED" then
30743073
local function isDesecratedMod(mod)
30753074
for _, tag in ipairs(mod.modTags or { }) do

0 commit comments

Comments
 (0)