Fixed possible AbstractNpcInfo NPE.

Contributed by Sahar.
This commit is contained in:
MobiusDev
2018-05-30 21:06:47 +00:00
parent aafd0051e8
commit 287a5b30f7

View File

@@ -30,6 +30,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance; import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect; import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
import com.l2jmobius.gameserver.model.zone.ZoneId; import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.model.zone.type.L2TownZone;
import com.l2jmobius.gameserver.network.OutgoingPackets; import com.l2jmobius.gameserver.network.OutgoingPackets;
public abstract class AbstractNpcInfo implements IClientOutgoingPacket public abstract class AbstractNpcInfo implements IClientOutgoingPacket
@@ -127,7 +128,10 @@ public abstract class AbstractNpcInfo implements IClientOutgoingPacket
// npc crest of owning clan/ally of castle // npc crest of owning clan/ally of castle
if ((cha instanceof L2NpcInstance) && cha.isInsideZone(ZoneId.TOWN) && (Config.SHOW_CREST_WITHOUT_QUEST || cha.getCastle().getShowNpcCrest()) && (cha.getCastle().getOwnerId() != 0)) if ((cha instanceof L2NpcInstance) && cha.isInsideZone(ZoneId.TOWN) && (Config.SHOW_CREST_WITHOUT_QUEST || cha.getCastle().getShowNpcCrest()) && (cha.getCastle().getOwnerId() != 0))
{ {
final int townId = TownManager.getTown(_x, _y, _z).getTownId(); final L2TownZone town = TownManager.getTown(_x, _y, _z);
if (town != null)
{
final int townId = town.getTownId();
if ((townId != 33) && (townId != 22)) if ((townId != 33) && (townId != 22))
{ {
final L2Clan clan = ClanTable.getInstance().getClan(cha.getCastle().getOwnerId()); final L2Clan clan = ClanTable.getInstance().getClan(cha.getCastle().getOwnerId());
@@ -137,6 +141,7 @@ public abstract class AbstractNpcInfo implements IClientOutgoingPacket
_allyId = clan.getAllyId(); _allyId = clan.getAllyId();
} }
} }
}
_displayEffect = cha.getDisplayEffect(); _displayEffect = cha.getDisplayEffect();
} }