From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 5 Apr 2024 22:49:44 +0000 (+1100) Subject: Alerts crash fix (#26602) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=dd03612d8032050e4d60b8ac7fffae4d5911d422;p=space-station-14.git Alerts crash fix (#26602) - If the client tries to call ShowAlert while applying gamestates (e.g. initialising an entity) then this will cause problems. I need to double-check the initial PR before I'd be comfortable with this being merged. --- diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index d8737a717a..5b888e30c4 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -80,6 +80,10 @@ public abstract class AlertsSystem : EntitySystem /// if true, the cooldown will be visibly shown over the alert icon public void ShowAlert(EntityUid euid, AlertType alertType, short? severity = null, (TimeSpan, TimeSpan)? cooldown = null, bool autoRemove = false, bool showCooldown = true ) { + // This should be handled as part of networking. + if (_timing.ApplyingState) + return; + if (!TryComp(euid, out AlertsComponent? alertsComponent)) return; @@ -148,6 +152,9 @@ public abstract class AlertsSystem : EntitySystem /// public void ClearAlert(EntityUid euid, AlertType alertType) { + if (_timing.ApplyingState) + return; + if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) return;