From a73c5ba32370a867648d07c88360a11be53150e5 Mon Sep 17 00:00:00 2001 From: Exp Date: Sun, 2 Aug 2020 17:31:43 +0200 Subject: [PATCH] Fix removehand throwing exception when no hand exists (#1570) * Fix removehand throwing exception when no hand exists * Message when you have no hands --- Content.Server/GameTicking/GameTickerCommands.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameTicking/GameTickerCommands.cs b/Content.Server/GameTicking/GameTickerCommands.cs index 8b7676f08f..839dddf891 100644 --- a/Content.Server/GameTicking/GameTickerCommands.cs +++ b/Content.Server/GameTicking/GameTickerCommands.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Content.Server.BodySystem; @@ -388,8 +388,16 @@ namespace Content.Server.GameTicking } var manager = player.AttachedEntity.GetComponent(); - var hand = manager.PartDictionary.First(x => x.Value.PartType == BodyPartType.Hand); - manager.DisconnectBodyPart(hand.Value, true); + var hand = manager.PartDictionary.FirstOrDefault(x => x.Value.PartType == BodyPartType.Hand); + if (hand.Value == null) + { + shell.SendText(player, "You have no hands."); + return; + } + else + { + manager.DisconnectBodyPart(hand.Value, true); + } } } }