From 75c176c02818c3bf8e4e3c0ad198aaf97ac799d8 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 28 Feb 2021 18:41:25 -0800 Subject: [PATCH] Fix: Replace All items using a copy of the tile The field array will get mutated, so make sure that our item reference isn't one of the field tiles. --- NHSE.WinForms/Subforms/Map/FieldItemEditor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs b/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs index 764859a..2ffd140 100644 --- a/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs +++ b/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs @@ -389,7 +389,8 @@ private void ReplaceTile(Item tile, int x, int y) } bool wholeMap = (ModifierKeys & Keys.Shift) != 0; - var count = View.ReplaceFieldItems(tile, pgt, wholeMap); + var copy = new Item(tile.RawValue); + var count = View.ReplaceFieldItems(copy, pgt, wholeMap); if (count == 0) { WinFormsUtil.Alert(MessageStrings.MsgFieldItemModifyNone);