Skip to content

Commit

Permalink
Fix NPE when world can't be guessed
Browse files Browse the repository at this point in the history
Still doesn't get the world correctly, but at least it doesn't crash anymore...
  • Loading branch information
TechnicJelle committed Feb 16, 2024
1 parent 88b4c2a commit 950462e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public String getPlayerName(UUID playerUUID) {
public Optional<UUID> guessWorldUUID(Object object) {
if (object instanceof String) {
String dimensionString = (String) object;
return Optional.ofNullable(server.getWorld(dimensionString).getUID());
@Nullable World world = server.getWorld(dimensionString);
if (world == null) return Optional.empty();
return Optional.of(world.getUID());
}

if (object instanceof Integer) {
Expand Down

0 comments on commit 950462e

Please sign in to comment.