fix(UseDelaySystem): Use safe method to index into dictionary (#31135)

This commit is contained in:
Brandon Hu
2024-08-20 00:49:40 +00:00
committed by GitHub
parent 2839c62549
commit 9b23be3081

View 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)