Goobwabber/MultiplayerExtensions

[BUG] Object reference not set to an instance of an object

jabberjabberjabber opened this issue · 0 comments

Running 12.9.1 using BeatUpClient connecting to a BeatUpServer instance.

An exception was thrown processing custom packet 'MpexPlayerData' from player '(...)': Object reference not set to an instance of an object
System.NullReferenceException: Object reference not set to an instance of an object
  at MultiplayerExtensions.Players.MpexPlayerManager.HandlePlayerData (MultiplayerExtensions.Players.MpexPlayerData packet, IConnectedPlayer player) [0x00014] in <0719e2db656940a8aaaba55860e2abbb>:0 
  at MultiplayerCore.Networking.MpPacketSerializer+<>c__DisplayClass12_0`1[TPacket].<RegisterCallback>b__1 (LiteNetLib.Utils.NetDataReader reader, System.Int32 size, IConnectedPlayer player) [0x00013] in <2a7a06274ca84b5fb1a6ae53e1f3abb1>:0 
  at MultiplayerCore.Networking.MpPacketSerializer.Deserialize (LiteNetLib.Utils.NetDataReader reader, System.Int32 length, IConnectedPlayer data) [0x0003a] in <2a7a06274ca84b5fb1a6ae53e1f3abb1>:0 

Talked to rcelyte since they are client creator, and they found the issue is with MultiplayerExtensions and made a patch:

diff --git a/MultiplayerExtensions/Players/MpexPlayerManager.cs b/MultiplayerExtensions/Players/MpexPlayerManager.cs
index c644fd1..c1a4b0e 100644
--- a/MultiplayerExtensions/Players/MpexPlayerManager.cs
+++ b/MultiplayerExtensions/Players/MpexPlayerManager.cs
@@ -52,7 +52,7 @@ namespace MultiplayerExtensions.Players
 		private void HandlePlayerData(MpexPlayerData packet, IConnectedPlayer player)
 		{
 			_playerData[player.userId] = packet;
-			PlayerConnectedEvent(player, packet);
+			PlayerConnectedEvent?.Invoke(player, packet);
 		}

 
 		public bool TryGetPlayer(string userId, out MpexPlayerData player)

I am running it as a test.

Thought you'd like to know.