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