fix issues with icon/name not updating and NRE

This commit is contained in:
_nebula 2023-03-03 15:58:03 +00:00
parent 51ced1c474
commit be99b6957e

View File

@ -36,7 +36,7 @@ public class PlayerInformationMessage : QSBMessage
ClientState = player.State; ClientState = player.State;
FieldOfView = PlayerData.GetGraphicSettings().fieldOfView; FieldOfView = PlayerData.GetGraphicSettings().fieldOfView;
IsInShip = player.IsInShip; IsInShip = player.IsInShip;
HUDIcon = player.HUDBox.PlanetIcon; HUDIcon = player.HUDBox == null ? HUDIcon.UNKNOWN : player.HUDBox.PlanetIcon;
} }
public override void Serialize(NetworkWriter writer) public override void Serialize(NetworkWriter writer)
@ -99,11 +99,11 @@ public class PlayerInformationMessage : QSBMessage
player.State = ClientState; player.State = ClientState;
if (player.HUDBox != null) Delay.RunWhen(() => player.HUDBox != null, () =>
{ {
player.HUDBox.PlayerName.text = PlayerName.ToUpper(); player.HUDBox.PlayerName.text = PlayerName.ToUpper();
player.HUDBox.UpdateIcon(HUDIcon); player.HUDBox.UpdateIcon(HUDIcon);
} });
} }
else else
{ {