Residence zone null checks.

This commit is contained in:
MobiusDevelopment
2020-10-16 06:30:35 +00:00
parent b2ee30a67e
commit 729d7d9e3a
4 changed files with 16 additions and 6 deletions

View File

@@ -51,7 +51,10 @@ public class CastleZone extends ZoneRespawn
final int castleId = Integer.parseInt(value); final int castleId = Integer.parseInt(value);
// Register self to the correct castle // Register self to the correct castle
_castle = CastleManager.getInstance().getCastleById(castleId); _castle = CastleManager.getInstance().getCastleById(castleId);
_castle.setZone(this); if (_castle != null)
{
_castle.setZone(this);
}
break; break;
} }
default: default:

View File

@@ -47,10 +47,10 @@ public class ClanHallZone extends ZoneRespawn
{ {
_clanHallId = Integer.parseInt(value); _clanHallId = Integer.parseInt(value);
// Register self to the correct clan hall // Register self to the correct clan hall
final ClanHall ch = ClanHallManager.getInstance().getClanHallById(_clanHallId); final ClanHall clanHall = ClanHallManager.getInstance().getClanHallById(_clanHallId);
if (ch != null) if (clanHall != null)
{ {
ClanHallManager.getInstance().getClanHallById(_clanHallId).setZone(this); clanHall.setZone(this);
} }
break; break;
} }

View File

@@ -51,7 +51,10 @@ public class CastleZone extends ZoneRespawn
final int castleId = Integer.parseInt(value); final int castleId = Integer.parseInt(value);
// Register self to the correct castle // Register self to the correct castle
_castle = CastleManager.getInstance().getCastleById(castleId); _castle = CastleManager.getInstance().getCastleById(castleId);
_castle.setZone(this); if (_castle != null)
{
_castle.setZone(this);
}
break; break;
} }
default: default:

View File

@@ -47,7 +47,11 @@ public class ClanHallZone extends ZoneRespawn
{ {
_clanHallId = Integer.parseInt(value); _clanHallId = Integer.parseInt(value);
// Register self to the correct clan hall // Register self to the correct clan hall
ClanHallManager.getInstance().getClanHallById(_clanHallId).setZone(this); final ClanHall clanHall = ClanHallManager.getInstance().getClanHallById(_clanHallId);
if (clanHall != null)
{
clanHall.setZone(this);
}
break; break;
} }
default: default: