Skip to content
Snippets Groups Projects
Commit 3037ecfa authored by Zoey76's avatar Zoey76
Browse files

Preventing NPE on Enemy Summon target handler, fixes #295

parent 869c1a5e
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
import com.l2jserver.gameserver.model.zone.ZoneId;
/**
* Enemy Summon target handler implementation.
* @author UnAfraid
*/
public class EnemySummon implements ITargetTypeHandler
......@@ -34,10 +35,13 @@ public class EnemySummon implements ITargetTypeHandler
@Override
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
if (target.isSummon())
if ((target != null) && target.isSummon())
{
L2Summon targetSummon = (L2Summon) target;
if ((activeChar.isPlayer() && (activeChar.getSummon() != targetSummon) && !targetSummon.isDead() && ((targetSummon.getOwner().getPvpFlag() != 0) || (targetSummon.getOwner().getKarma() > 0))) || (targetSummon.getOwner().isInsideZone(ZoneId.PVP) && activeChar.getActingPlayer().isInsideZone(ZoneId.PVP)) || (targetSummon.getOwner().isInDuel() && activeChar.getActingPlayer().isInDuel() && (targetSummon.getOwner().getDuelId() == activeChar.getActingPlayer().getDuelId())))
final L2Summon targetSummon = (L2Summon) target;
if ((activeChar.isPlayer() && (activeChar.getSummon() != targetSummon) && //
!targetSummon.isDead() && ((targetSummon.getOwner().getPvpFlag() != 0) || (targetSummon.getOwner().getKarma() > 0))) || //
(targetSummon.getOwner().isInsideZone(ZoneId.PVP) && activeChar.getActingPlayer().isInsideZone(ZoneId.PVP)) || //
(targetSummon.getOwner().isInDuel() && activeChar.getActingPlayer().isInDuel() && (targetSummon.getOwner().getDuelId() == activeChar.getActingPlayer().getDuelId())))
{
return new L2Character[]
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment