Fixed nullpointers

This commit is contained in:
Beny 2019-06-03 20:34:09 +01:00
parent e264c50957
commit 5b4e7f382a
2 changed files with 4 additions and 4 deletions

View File

@ -4588,19 +4588,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
THashSet<RoomUnit> units = new THashSet<>(); THashSet<RoomUnit> units = new THashSet<>();
for (Habbo habbo : this.currentHabbos.values()) { for (Habbo habbo : this.currentHabbos.values()) {
if (habbo != null && habbo.getRoomUnit() != null && habbo.getRoomUnit().getRoom().getId() == this.getId()) { if (habbo != null && habbo.getRoomUnit() != null && habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit().getRoom().getId() == this.getId()) {
units.add(habbo.getRoomUnit()); units.add(habbo.getRoomUnit());
} }
} }
for (Pet pet : this.currentPets.valueCollection()) { for (Pet pet : this.currentPets.valueCollection()) {
if (pet != null && pet.getRoomUnit() != null && pet.getRoomUnit().getRoom().getId() == this.getId()) { if (pet != null && pet.getRoomUnit() != null && pet.getRoomUnit().getRoom() != null && pet.getRoomUnit().getRoom().getId() == this.getId()) {
units.add(pet.getRoomUnit()); units.add(pet.getRoomUnit());
} }
} }
for (Bot bot : this.currentBots.valueCollection()) { for (Bot bot : this.currentBots.valueCollection()) {
if (bot != null && bot.getRoomUnit() != null && bot.getRoomUnit().getRoom().getId() == this.getId()) { if (bot != null && bot.getRoomUnit() != null && bot.getRoomUnit().getRoom() != null && bot.getRoomUnit().getRoom().getId() == this.getId()) {
units.add(bot.getRoomUnit()); units.add(bot.getRoomUnit());
} }
} }

View File

@ -333,7 +333,7 @@ public class RoomUnit {
this.resetIdleTimer(); this.resetIdleTimer();
if (habbo != null) { if (habbo != null) {
HabboItem topItem = this.room.getTopItemAt(next.x, next.y); HabboItem topItem = room.getTopItemAt(next.x, next.y);
boolean isAtDoor = next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY(); boolean isAtDoor = next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY();
boolean publicRoomKicks = !room.isPublicRoom() || Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick"); boolean publicRoomKicks = !room.isPublicRoom() || Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick");