From c0c4d8e02c4faf1f99f5897d90a70f3f90115fd0 Mon Sep 17 00:00:00 2001 From: Trifall Date: Fri, 14 Aug 2026 01:37:36 -0400 Subject: [PATCH] fix crash on invalid support gem custom mod --- spec/System/TestSkills_spec.lua | 31 +++++++++++++++++++++++++++++++ src/Modules/CalcSetup.lua | 5 ++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/spec/System/TestSkills_spec.lua b/spec/System/TestSkills_spec.lua index af8896f64c..1813d90d61 100644 --- a/spec/System/TestSkills_spec.lua +++ b/spec/System/TestSkills_spec.lua @@ -511,4 +511,35 @@ describe("TestSkills", function() assert.is_nil(build.calcsTab.mainOutput[test[3]]) end end) + + it("ignores invalid extra supports while allowing support name collisions", function() + build.skillsTab:PasteSocketGroup("Slot: Gloves\nFireball 20/0 1") + runCallback("OnFrame") + build.configTab.input.customMods = "Skills socketed in your gloves are supported by level 20 Arc" + build.configTab:BuildModList() + build.modFlag = true + build.buildFlag = true + assert.has_no.errors(function() + main:OnFrame() + end) + assert.are.equals(0, #build.calcsTab.mainEnv.player.mainSkill.supportList) + + newBuild() + build.skillsTab:PasteSocketGroup("Slot: Gloves\nFireball 20/0 1") + build.configTab.input.customMods = "Skills socketed in your gloves are supported by level 20 Arcane Surge" + build.configTab:BuildModList() + main:OnFrame() + local arcaneSurge = build.calcsTab.mainEnv.player.mainSkill.supportList[1] + assert.are.equals("SupportArcaneSurge", arcaneSurge.grantedEffect.id) + assert.are.equals(20, arcaneSurge.level) + + newBuild() + build.skillsTab:PasteSocketGroup("Slot: Gloves\nRain of Arrows 20/0 1") + build.configTab.input.customMods = "Skills socketed in your gloves are supported by level 20 Barrage" + build.configTab:BuildModList() + main:OnFrame() + local barrage = build.calcsTab.mainEnv.player.mainSkill.supportList[1] + assert.are.equals("SupportBarrage", barrage.grantedEffect.id) + assert.are.equals(20, barrage.level) + end) end) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 5b2d481a3c..976d3785d0 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -1525,14 +1525,13 @@ function calcs.initEnv(build, mode, override, specEnv) local function addExtraSupports(value, grantedEffect, level) local grantedEffect = grantedEffect or env.data.skills[value.skillId] - if value and grantedEffect then -- Only item ExtraSupport gems should be flagged as fromItem. Imbued gems do not pass this check - grantedEffect.fromItem = true - end -- Some skill gems share the same name as support gems, e.g. Barrage. -- Since a support gem is expected here, if the first lookup returns a skill, then -- prepending "Support" to the skillId will find the support version of the gem. if value and grantedEffect and not grantedEffect.support then grantedEffect = env.data.skills["Support"..value.skillId] + end + if value and grantedEffect then -- Only item ExtraSupport gems should be flagged as fromItem. Imbued gems do not pass this check grantedEffect.fromItem = true end if grantedEffect then