fix: add null check for bukkit world ref (#4443)

This commit is contained in:
Jordan 2024-06-16 10:53:50 +02:00 committed by GitHub
parent c4bd6b6500
commit 670f5a802e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,7 +75,7 @@ public class BukkitWorld implements World<org.bukkit.World> {
public static @NonNull BukkitWorld of(final org.bukkit.World world) {
WeakReference<BukkitWorld> bukkitWorldRef = worldMap.get(world.getName());
BukkitWorld bukkitWorld;
if ((bukkitWorld = bukkitWorldRef.get()) != null && world.equals(bukkitWorld.world.get())) {
if (bukkitWorldRef != null && (bukkitWorld = bukkitWorldRef.get()) != null && world.equals(bukkitWorld.world.get())) {
return bukkitWorld;
}
bukkitWorld = new BukkitWorld(world);