From 2f5ca65542a587aa0acaebf71b61c36d3f332e35 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 3 Aug 2018 19:54:58 +0300 Subject: [PATCH] Fixed nullref exceptions when a character dies while holding an item. --- Barotrauma/BarotraumaShared/Source/Characters/Character.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 1242b7aa6..0f33c6f10 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -2044,6 +2044,9 @@ namespace Barotrauma base.Remove(); + if (selectedItems[0] != null) selectedItems[0].Drop(this); + if (selectedItems[1] != null) selectedItems[1].Drop(this); + if (info != null) info.Remove(); CharacterList.Remove(this); @@ -2054,9 +2057,6 @@ namespace Barotrauma if (AnimController != null) AnimController.Remove(); - if (selectedItems[0] != null) selectedItems[0].Drop(this); - if (selectedItems[1] != null) selectedItems[1].Drop(this); - foreach (Character c in CharacterList) { if (c.focusedCharacter == this) c.focusedCharacter = null;