Skip to content

Commit 9ca372c

Browse files
committed
set
1 parent 573db1c commit 9ca372c

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Content.Shared/StatusEffect/StatusEffectsComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public sealed partial class StatusEffectsComponent : Component
1515
/// A list of status effect IDs to be allowed
1616
/// </summary>
1717
[DataField("allowed", required: true), Access(typeof(StatusEffectsSystem), Other = AccessPermissions.ReadExecute)]
18-
public List<string> AllowedEffects = default!;
18+
public List<string> AllowedEffects = new();
1919
}
2020

2121
[RegisterComponent]

Content.Shared/StatusEffect/StatusEffectsSystem.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ private void OnGetState(EntityUid uid, StatusEffectsComponent component, ref Com
6161
{
6262
// Using new(...) To avoid mispredictions due to MergeImplicitData. This will mean the server-side code is
6363
// slightly slower, and really this function should just be overridden by the client...
64+
component.ActiveEffects ??= new();
65+
component.AllowedEffects ??= new();
6466
args.State = new StatusEffectsComponentState(new(component.ActiveEffects), new(component.AllowedEffects));
6567
}
6668

@@ -69,6 +71,11 @@ private void OnHandleState(EntityUid uid, StatusEffectsComponent component, ref
6971
if (args.Current is not StatusEffectsComponentState state)
7072
return;
7173

74+
component.ActiveEffects ??= new();
75+
component.AllowedEffects ??= new();
76+
state.ActiveEffects ??= new();
77+
state.AllowedEffects ??= new();
78+
7279
component.AllowedEffects.Clear();
7380
component.AllowedEffects.AddRange(state.AllowedEffects);
7481

0 commit comments

Comments
 (0)