Fixed probable Player getPlayerSide NPE.

This commit is contained in:
MobiusDevelopment
2022-04-07 18:58:20 +00:00
parent 48c6ffce5c
commit 2897ec40a8
23 changed files with 345 additions and 46 deletions

View File

@@ -13587,11 +13587,24 @@ public class Player extends Playable
*/
public CastleSide getPlayerSide()
{
if ((_clan == null) || (_clan.getCastleId() == 0))
if (_clan == null)
{
return CastleSide.NEUTRAL;
}
return CastleManager.getInstance().getCastleById(getClan().getCastleId()).getSide();
final int castleId = _clan.getCastleId();
if (castleId == 0)
{
return CastleSide.NEUTRAL;
}
final Castle castle = CastleManager.getInstance().getCastleById(castleId);
if (castle == null)
{
return CastleSide.NEUTRAL;
}
return castle.getSide();
}
/**