From: Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> Date: Tue, 20 Aug 2024 00:49:40 +0000 (+0000) Subject: fix(UseDelaySystem): Use safe method to index into dictionary (#31135) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=9b23be30812b69a4845e44aa200831ef7f5299db;p=space-station-14.git fix(UseDelaySystem): Use safe method to index into dictionary (#31135) --- diff --git a/Content.Shared/Timing/UseDelaySystem.cs b/Content.Shared/Timing/UseDelaySystem.cs index 9816d0185a..9707a4ddbe 100644 --- a/Content.Shared/Timing/UseDelaySystem.cs +++ b/Content.Shared/Timing/UseDelaySystem.cs @@ -125,7 +125,9 @@ public sealed class UseDelaySystem : EntitySystem /// public UseDelayInfo GetLastEndingDelay(Entity ent) { - var last = ent.Comp.Delays[DefaultId]; + if (!ent.Comp.Delays.TryGetValue(DefaultId, out var last)) + return new UseDelayInfo(TimeSpan.Zero); + foreach (var entry in ent.Comp.Delays) { if (entry.Value.EndTime > last.EndTime)