From 41ecaa27d0f300178f32a4c33d7a7e55101115d3 Mon Sep 17 00:00:00 2001 From: Leah Date: Sat, 18 Jul 2026 12:11:28 +0200 Subject: [PATCH] fix unhandled ArgumentException when a duplicate shop cost modifier is added (#42064) * add map containskey check * review --------- Co-authored-by: AJCM-git --- Content.Shared/Store/ListingPrototype.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Store/ListingPrototype.cs b/Content.Shared/Store/ListingPrototype.cs index 00d912ede9..a45c020526 100644 --- a/Content.Shared/Store/ListingPrototype.cs +++ b/Content.Shared/Store/ListingPrototype.cs @@ -346,11 +346,10 @@ public sealed partial class ListingDataWithCostModifiers : ListingData /// Values for cost modification. public void AddCostModifier(string modifierSourceId, Dictionary, FixedPoint2> modifiers) { - CostModifiersBySourceId.Add(modifierSourceId, modifiers); + CostModifiersBySourceId.TryAdd(modifierSourceId, modifiers); + if (_costModified != null) - { _costModified = ApplyAllModifiers(); - } } /// Remove cost modifier with passed sourceId.