From 6f63e5a888715afb3cd73632fc8606f4546ad380 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Sat, 16 Oct 2021 00:52:35 +0200 Subject: [PATCH] StatusEffects ignore components that are not there anymore, when removing effects --- Content.Shared/StatusEffect/StatusEffectsSystem.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index 418451f9d7..be854aacb7 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -216,7 +216,13 @@ namespace Content.Shared.StatusEffect if (state.RelevantComponent != null) { var type = _componentFactory.GetRegistration(state.RelevantComponent).Type; - EntityManager.RemoveComponent(uid, type); + + // Make sure the component is actually there first. + // Maybe a badmin badminned the component away, + // or perhaps, on the client, the component deletion sync + // was faster than prediction could predict. Either way, let's not assume the component exists. + if(EntityManager.HasComponent(uid, type)) + EntityManager.RemoveComponent(uid, type); } if (proto.Alert != null && alerts != null)