diff --git a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua index 0654d3c863..51696093fa 100644 --- a/spec/System/TestItemParse_spec.lua +++ b/spec/System/TestItemParse_spec.lua @@ -1358,5 +1358,36 @@ describe("TestAdvancedItemParse #item", function() assert.equal(27, spellCrit()) assert.equal(8, spellDamage()) end) + + + it("does not overwrite existing values when a suffix magnitude mod fails to parse", function() + -- grantedExtraSkill returns (nil) when the skill is missing from gemIdLookup, + -- so parseMod also returns nil (no second value) -> overwriting both modList and extra when the magnitude loop runs + local item = new("Item", [[ + Item Class: Rings + Rarity: Rare + Plague Knuckle + Helical Ring + -------- + Item Level: 84 + -------- + { Implicit Modifier } + 50% increased Suffix Modifier magnitudes + -------- + { Suffix Modifier "of !!UNPARSEABLE!!" — 50% Increased } + Grants Level 20 Aspect of !!UNPARSEABLE!! Skill + -------- + ]]) + assert.truthy(item.base) + local aspectLine + for _, modLine in ipairs(item.explicitModLines) do + if modLine.line:find("UNPARSEABLE", 1, true) then + aspectLine = modLine + end + end + assert.truthy(aspectLine) + assert.truthy(aspectLine.modList) + assert.truthy(aspectLine.extra) + end) end) end) diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index c0d2e7a7dc..1d211aa20f 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -1420,9 +1420,11 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) if mod.valueScalar and mod.valueScalar ~= 1 then local rangedLine = itemLib.applyRange(mod.line, mod.range or 1, mod.valueScalar, 1) local modList, extra = modLib.parseMod(rangedLine) - mod.displayValueScalar = 1 - mod.modList = modList - mod.extra = extra + if modList then + mod.displayValueScalar = 1 + mod.modList = modList + mod.extra = extra + end end ::modMagnitudeContinue:: end