diff options
author | Jake Potrebic <[email protected]> | 2023-10-29 08:33:32 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-10-29 15:33:32 +0000 |
commit | 1865625d958b94d82e0bd601d6d860318980c4c4 (patch) | |
tree | 97d970a2c2c16ba17d35f68ad4fda26a0ffadec7 | |
parent | 5bb30ce95b14293f5bfebf10be2fdf929eabcc01 (diff) | |
download | Paper-1865625d958b94d82e0bd601d6d860318980c4c4.tar.gz Paper-1865625d958b94d82e0bd601d6d860318980c4c4.zip |
Fix NPE when no valid world is found on legacy Players (#9885)
-rw-r--r-- | patches/server/1043-Fix-NPE-when-no-valid-world-is-found-on-legacy-Playe.patch | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/1043-Fix-NPE-when-no-valid-world-is-found-on-legacy-Playe.patch b/patches/server/1043-Fix-NPE-when-no-valid-world-is-found-on-legacy-Playe.patch new file mode 100644 index 0000000000..17028be297 --- /dev/null +++ b/patches/server/1043-Fix-NPE-when-no-valid-world-is-found-on-legacy-Playe.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Sat, 28 Oct 2023 23:21:49 -0700 +Subject: [PATCH] Fix NPE when no valid world is found on legacy Players + + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 03d2dc7f68d6918065f852057321fbaaf22fb413..30dd56871acff2dd730d96406520bab066229d7a 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -221,9 +221,9 @@ public abstract class PlayerList { + Logger logger = PlayerList.LOGGER; + + Objects.requireNonNull(logger); +- resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD ++ resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel() != null ? player.serverLevel().dimension() : Level.OVERWORLD); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD // Paper - account for null level + } else { +- resourcekey = player.serverLevel().dimension(); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD ++ resourcekey = player.serverLevel() != null ? player.serverLevel().dimension() : Level.OVERWORLD; // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD // Paper - account for null level + } + + ResourceKey<Level> resourcekey1 = resourcekey; |