Skip to content

Commit

Permalink
player.essentials_homes: null check locations
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 25, 2022
1 parent 9e1f3f9 commit e159651
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.denizenscript.denizencore.tags.Attribute;
import com.denizenscript.denizencore.objects.properties.Property;
import com.denizenscript.depenizen.bukkit.bridges.EssentialsBridge;
import org.bukkit.Location;

import java.util.UUID;

Expand Down Expand Up @@ -137,7 +138,10 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
MapTag homes = new MapTag();
for (String home : getUser().getHomes()) {
try {
homes.putObject(home, new LocationTag(getUser().getHome(home)));
Location homeLoc = getUser().getHome(home);
if (homeLoc != null) { // home location can be null if the world isn't loaded
homes.putObject(home, new LocationTag(homeLoc));
}
}
catch (Exception e) {
if (!attribute.hasAlternative()) {
Expand Down

0 comments on commit e159651

Please sign in to comment.