From fdd61d1c94cb5d7bfd3d9d6ea9cbee1483625229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Tue, 1 Sep 2020 03:08:32 +0200 Subject: [PATCH] Fix instrument crash when you put an instrument in Urist's hands --- .../Components/Instruments/InstrumentComponent.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs index 3af194ba8d..9947e7d1e9 100644 --- a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs +++ b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs @@ -246,9 +246,12 @@ namespace Content.Server.GameObjects.Components.Instruments public void HandSelected(HandSelectedEventArgs eventArgs) { - var session = eventArgs.User?.GetComponent()?.playerSession; + if (eventArgs.User == null || !eventArgs.User.TryGetComponent(out BasicActorComponent? actor)) + return; - if (session == null) return; + var session = actor.playerSession; + + if (session.Status != SessionStatus.InGame) return; InstrumentPlayer = session; }