Fixed potential Attackable NPE.

This commit is contained in:
MobiusDevelopment
2022-10-01 10:24:04 +00:00
parent 27f19f4e0b
commit 97180dfefc

View File

@@ -134,27 +134,28 @@ public class Attackable extends Npc
}
else if (isDead())
{
final Attackable attackable = this;
synchronized (attackable)
synchronized (this)
{
if (!_killedAlready)
{
_killedAlready = true;
stopRandomWalking();
stopTargetScan();
calculateRewards(attacker);
final Player killer = attacker.getActingPlayer();
if ((killer != null) && (killer.getKarma() > 0))
calculateRewards();
if (attacker != null)
{
killer.decreaseKarma();
final Player killer = attacker.getActingPlayer();
if ((killer != null) && (killer.getKarma() > 0))
{
killer.decreaseKarma();
}
}
}
}
}
}
private void calculateRewards(Creature lastAttacker)
private void calculateRewards()
{
// TODO: Figure iterator logic and replace with for, if possible.
Iterator<WorldObject> it = _aggroList.keySet().iterator();