diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index 462713567..c1edf24d9 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -564,6 +564,7 @@ namespace Barotrauma if (newItemIDs[i] == 0) { if (Items[i] != null) Items[i].Drop(); + System.Diagnostics.Debug.Assert(Items[i]==null); } else { diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index 34b1990c1..09bf80dcb 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -1529,7 +1529,17 @@ namespace Barotrauma { foreach (ItemComponent ic in components) ic.Drop(dropper); - if (Container != null) Container.RemoveContained(this); + if (Container != null) + { + Container.RemoveContained(this); + Container = null; + } + + if (parentInventory != null) + { + parentInventory.RemoveItem(this); + parentInventory = null; + } } public void Equip(Character character)