From a854a8687217a9d21d2cb1f20f9695a9cb796326 Mon Sep 17 00:00:00 2001 From: NuclearWinter Date: Tue, 25 Aug 2020 05:37:54 -0600 Subject: [PATCH] Fixes ghost NRE in lobby (#1907) Simply tells the player "You can't ghost here!" when they try it in the lobby, works for both normal ghost and aghost --- Content.Server/Administration/AGhost.cs | 6 ++++++ Content.Server/Observer/Ghost.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Content.Server/Administration/AGhost.cs b/Content.Server/Administration/AGhost.cs index dfe516576b..5226c4637f 100644 --- a/Content.Server/Administration/AGhost.cs +++ b/Content.Server/Administration/AGhost.cs @@ -22,6 +22,12 @@ namespace Content.Server.Administration } var mind = player.ContentData().Mind; + if (mind == null) + { + shell.SendText(player, "You can't ghost here!"); + return; + } + if (mind.VisitingEntity != null && mind.VisitingEntity.Prototype.ID == "AdminObserver") { var visiting = mind.VisitingEntity; diff --git a/Content.Server/Observer/Ghost.cs b/Content.Server/Observer/Ghost.cs index 6c71882c9e..e1ea953bd6 100644 --- a/Content.Server/Observer/Ghost.cs +++ b/Content.Server/Observer/Ghost.cs @@ -28,6 +28,12 @@ namespace Content.Server.Observer } var mind = player.ContentData().Mind; + if (mind == null) + { + shell.SendText(player, "You can't ghost here!"); + return; + } + var canReturn = player.AttachedEntity != null && CanReturn; var name = player.AttachedEntity?.Name ?? player.Name;