Fixed nullref exceptions when a character dies while holding an item.

This commit is contained in:
Joonas Rikkonen
2018-08-03 19:54:58 +03:00
parent cafcc76064
commit 2f5ca65542
@@ -2044,6 +2044,9 @@ namespace Barotrauma
base.Remove(); base.Remove();
if (selectedItems[0] != null) selectedItems[0].Drop(this);
if (selectedItems[1] != null) selectedItems[1].Drop(this);
if (info != null) info.Remove(); if (info != null) info.Remove();
CharacterList.Remove(this); CharacterList.Remove(this);
@@ -2054,9 +2057,6 @@ namespace Barotrauma
if (AnimController != null) AnimController.Remove(); 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) foreach (Character c in CharacterList)
{ {
if (c.focusedCharacter == this) c.focusedCharacter = null; if (c.focusedCharacter == this) c.focusedCharacter = null;