Fix for exceptions when a human is targeting a removed entity while debugdraw is enabled, accessing AITarget position properties after the target has been destroyed doesn't throw an exception (but does log an error in debug builds).

This commit is contained in:
Joonas Rikkonen
2017-08-13 20:00:52 +03:00
parent 4d40f5d483
commit c7a357d84c
2 changed files with 25 additions and 3 deletions
@@ -21,7 +21,7 @@ namespace Barotrauma
public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
{
if (selectedAiTarget != null)
if (selectedAiTarget?.Entity != null)
{
GUI.DrawLine(spriteBatch,
new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),