From d47643e730a30f0b617bebd005069aa71d091320 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 15 Apr 2024 15:48:15 -0400 Subject: [PATCH] Error logging added --- src/engine/net/client/msg/ItemProductionMsg.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/engine/net/client/msg/ItemProductionMsg.java b/src/engine/net/client/msg/ItemProductionMsg.java index df25ccca..7d1ae595 100644 --- a/src/engine/net/client/msg/ItemProductionMsg.java +++ b/src/engine/net/client/msg/ItemProductionMsg.java @@ -17,6 +17,7 @@ import engine.net.*; import engine.objects.Building; import engine.objects.Item; import engine.objects.NPC; +import org.pmw.tinylog.Logger; import java.util.HashMap; @@ -126,12 +127,17 @@ public class ItemProductionMsg extends ClientNetMsg { writer.put((byte) 1); Item item; + if (this.itemUUID > 0) item = Item.getFromCache(this.itemUUID); else item = ForgeManager.inMemoryItemLookup.get(this.itemUUID); - Item.serializeForClientMsgWithoutSlot(item, writer); + if (item == null) + Logger.error("Null item serialized"); + else + Item.serializeForClientMsgWithoutSlot(item, writer); + writer.putInt(building.getStrongboxValue()); writer.putInt(0); writer.putInt(0); @@ -149,7 +155,10 @@ public class ItemProductionMsg extends ClientNetMsg { else item = ForgeManager.inMemoryItemLookup.get(this.itemUUID); - Item.serializeForClientMsgWithoutSlot(item, writer); + if (item == null) + Logger.error("Null item serialized"); + else + Item.serializeForClientMsgWithoutSlot(item, writer); writer.putInt(building.getStrongboxValue()); writer.putInt(0);