Fixed party NPE by caching leader variable.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2021-07-23 23:18:40 +00:00
parent 27dc3eb506
commit e08d53462e
2 changed files with 11 additions and 8 deletions

View File

@@ -482,12 +482,13 @@ public class Party extends AbstractPlayerGroup
}
}
if (getLeader() != null)
final PlayerInstance leader = getLeader();
if (leader != null)
{
getLeader().setParty(null);
if (getLeader().isInDuel())
leader.setParty(null);
if (leader.isInDuel())
{
DuelManager.getInstance().onRemoveFromParty(getLeader());
DuelManager.getInstance().onRemoveFromParty(leader);
}
}
if (_positionBroadcastTask != null)

View File

@@ -495,14 +495,16 @@ public class Party extends AbstractPlayerGroup
}
}
if (getLeader() != null)
final PlayerInstance leader = getLeader();
if (leader != null)
{
getLeader().setParty(null);
if (getLeader().isInDuel())
leader.setParty(null);
if (leader.isInDuel())
{
DuelManager.getInstance().onRemoveFromParty(getLeader());
DuelManager.getInstance().onRemoveFromParty(leader);
}
}
if (_changeDistributionTypeRequestTask != null)
{
_changeDistributionTypeRequestTask.cancel(true);