]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix(UseDelaySystem): Use safe method to index into dictionary (#31135)
authorBrandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
Tue, 20 Aug 2024 00:49:40 +0000 (00:49 +0000)
committerGitHub <noreply@github.com>
Tue, 20 Aug 2024 00:49:40 +0000 (20:49 -0400)
Content.Shared/Timing/UseDelaySystem.cs

index 9816d0185a5d078ea8861fc8369c50c24eba9e2b..9707a4ddbe567fe44b373b1d20aa21f8bf7637be 100644 (file)
@@ -125,7 +125,9 @@ public sealed class UseDelaySystem : EntitySystem
     /// </summary>
     public UseDelayInfo GetLastEndingDelay(Entity<UseDelayComponent> 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)