From c0521ba2b76fc7e26be8eadc01c7af3cae7e9339 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 1 May 2023 14:10:09 -0400 Subject: [PATCH] null check for building owner. --- src/engine/objects/NPC.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index a705e08b..214cefc7 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -240,9 +240,13 @@ public class NPC extends AbstractCharacter { submitUpgradeJob(); this.name = rs.getString("npc_name"); - if(this.building != null && this.building.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)){ + + // Name override for player owned npcs + + if (this.building != null && + this.building.getOwner() != null && + this.building.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) this.name += " the " + this.contract.getName(); - } }catch(Exception e){ Logger.error(e);