From 1bd856b7a54668c23872e216194465db35ead1dc Mon Sep 17 00:00:00 2001 From: Regalis Date: Wed, 12 Apr 2017 23:47:26 +0300 Subject: [PATCH] ItemComponent update events aren't created if the component isn't found in the item's component list (may happen if an event is created when setting a property of a component during initialization) --- Subsurface/Source/Items/Item.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index 25326cc6a..3acea3114 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -2289,6 +2289,8 @@ namespace Barotrauma if (GameMain.Server == null) return; int index = components.IndexOf(ic); + if (index == -1) return; + GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ComponentState, index }); } @@ -2297,6 +2299,8 @@ namespace Barotrauma if (GameMain.Client == null) return; int index = components.IndexOf(ic); + if (index == -1) return; + GameMain.Client.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.ComponentState, index }); }