Error logging when receiving an inventory network event for a character with no inventory

This commit is contained in:
Joonas Rikkonen
2018-11-22 18:50:35 +02:00
parent f12aa2fadc
commit 1f2c18f7dd

View File

@@ -174,7 +174,16 @@ namespace Barotrauma
switch (eventType)
{
case 0:
inventory.ClientRead(type, msg, sendingTime);
if (inventory == null)
{
string errorMsg = "Received an inventory update message for an entity with no inventory (" + Name + ")";
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("CharacterNetworking.ClientRead:NoInventory" + ID, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
}
else
{
inventory?.ClientRead(type, msg, sendingTime);
}
break;
case 1:
byte ownerID = msg.ReadByte();