Bunch of fixes to null reference exceptions caused by removing characters mid-round

This commit is contained in:
Joonas Rikkonen
2017-06-21 16:56:35 +03:00
parent 4ac9aa09c6
commit 38f92acf8e
4 changed files with 28 additions and 8 deletions
+8 -1
View File
@@ -1959,6 +1959,13 @@ namespace Barotrauma
public override void Remove()
{
#if DEBUG
if (Removed)
{
DebugConsole.ThrowError("Attempting to remove an already removed character\n" + Environment.StackTrace);
}
#endif
base.Remove();
if (info != null) info.Remove();
@@ -1969,7 +1976,7 @@ namespace Barotrauma
if (GameMain.Client != null && GameMain.Client.Character == this) GameMain.Client.Character = null;
if (aiTarget != null) aiTarget.Remove();
if (aiTarget != null) aiTarget.Remove();
if (AnimController != null) AnimController.Remove();