Fix NPE in getSafeHomeLocation (#1650) (#1651)

This commit is contained in:
Thomas Cordua-von Specht 2021-01-20 15:48:22 -08:00 committed by GitHub
parent 942c1ff3b3
commit 737ad16ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -627,7 +627,7 @@ public class IslandsManager {
// location // location
if (plugin.getIslands().inTeam(world, user.getUniqueId())) { if (plugin.getIslands().inTeam(world, user.getUniqueId())) {
l = plugin.getIslands().getIslandLocation(world, user.getUniqueId()); l = plugin.getIslands().getIslandLocation(world, user.getUniqueId());
if (isSafeLocation(l)) { if (l != null && isSafeLocation(l)) {
plugin.getPlayers().setHomeLocation(user, l, number); plugin.getPlayers().setHomeLocation(user, l, number);
return l; return l;
} else { } else {
@ -640,7 +640,7 @@ public class IslandsManager {
} }
} else { } else {
l = plugin.getIslands().getIslandLocation(world, user.getUniqueId()); l = plugin.getIslands().getIslandLocation(world, user.getUniqueId());
if (isSafeLocation(l)) { if (l != null && isSafeLocation(l)) {
plugin.getPlayers().setHomeLocation(user, l, number); plugin.getPlayers().setHomeLocation(user, l, number);
return l.clone().add(new Vector(0.5D,0,0.5D)); return l.clone().add(new Vector(0.5D,0,0.5D));
} }