Fixed possible NPE at Parade ai.

This commit is contained in:
mobius
2015-01-29 19:25:38 +00:00
parent 6b7b09f11c
commit 9a958449a0

View File

@@ -223,14 +223,17 @@ public class Parade extends AbstractNpcAI
for (Iterator<L2Npc> it = spawns.iterator(); it.hasNext();) for (Iterator<L2Npc> it = spawns.iterator(); it.hasNext();)
{ {
L2Npc actor = it.next(); L2Npc actor = it.next();
if (actor.calculateDistance(actor.getXdestination(), actor.getYdestination(), 0, false, true) < (100 * 100)) if (actor != null)
{ {
actor.deleteMe(); if (actor.calculateDistance(actor.getXdestination(), actor.getYdestination(), 0, false, true) < (100 * 100))
it.remove(); {
} actor.deleteMe();
else if (!actor.isMoving()) it.remove();
{ }
actor.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(actor.getXdestination(), actor.getYdestination(), actor.getZdestination(), actor.getHeading())); else if (!actor.isMoving())
{
actor.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(actor.getXdestination(), actor.getYdestination(), actor.getZdestination(), actor.getHeading()));
}
} }
} }
if (spawns.size() == 0) if (spawns.size() == 0)