Skip to content

Commit

Permalink
Add null check in SystemState
Browse files Browse the repository at this point in the history
  • Loading branch information
behindcurtain3 committed Apr 18, 2024
1 parent c739e98 commit 43b684e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Pulsar4X/Pulsar4X.Client/MapRendering/SystemState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public SystemState(StarSystem system, Entity faction)
SetupEntity(entity, _faction);
}

Func<Message, bool> filterById = msg => msg.SystemId.Equals(StarSystem.ManagerGuid);
Func<Message, bool> filterById = msg => msg.SystemId != null && msg.SystemId.Equals(StarSystem.ManagerGuid);

MessagePublisher.Instance.Subscribe(MessageTypes.EntityAdded, OnEntityAddedMessage, filterById);
MessagePublisher.Instance.Subscribe(MessageTypes.EntityRemoved, OnEntityRemovedMessage, filterById);
Expand All @@ -65,7 +65,7 @@ public SystemState(StarSystem system, Entity faction)
SetupEntity(entityItem, faction);
}

Func<Message, bool> filterById = msg => msg.SystemId.Equals(StarSystem.ManagerGuid);
Func<Message, bool> filterById = msg => msg.SystemId != null && msg.SystemId.Equals(StarSystem.ManagerGuid);

MessagePublisher.Instance.Subscribe(MessageTypes.EntityAdded, OnEntityAddedMessage, filterById);
MessagePublisher.Instance.Subscribe(MessageTypes.EntityRemoved, OnEntityRemovedMessage, filterById);
Expand Down

0 comments on commit 43b684e

Please sign in to comment.