From: Bakke Date: Mon, 13 Nov 2023 22:53:54 +0000 (+0100) Subject: Fix CanImplant returning true when there's no implant (#21637) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=966201c6b3c704756038fefd436963950317ccb2;p=space-station-14.git Fix CanImplant returning true when there's no implant (#21637) In CanImplant, FirstOrDefault would make up a new implant with default values if there wasn't any to inject. This resulted in localization errors and exceptions. Replacing with FirstOrNull fixes the issue. --- diff --git a/Content.Shared/Implants/SharedImplanterSystem.cs b/Content.Shared/Implants/SharedImplanterSystem.cs index 404e6da508..b3b2421f20 100644 --- a/Content.Shared/Implants/SharedImplanterSystem.cs +++ b/Content.Shared/Implants/SharedImplanterSystem.cs @@ -9,6 +9,7 @@ using Content.Shared.Popups; using Content.Shared.Whitelist; using Robust.Shared.Containers; using Robust.Shared.Serialization; +using Robust.Shared.Utility; namespace Content.Shared.Implants; @@ -82,7 +83,7 @@ public abstract class SharedImplanterSystem : EntitySystem [NotNullWhen(true)] out EntityUid? implant, [NotNullWhen(true)] out SubdermalImplantComponent? implantComp) { - implant = component.ImplanterSlot.ContainerSlot?.ContainedEntities.FirstOrDefault(); + implant = component.ImplanterSlot.ContainerSlot?.ContainedEntities.FirstOrNull(); if (!TryComp(implant, out implantComp)) return false;