From e504c29df672c32f2baf851def5647492b2e2297 Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 23 Jul 2019 21:41:13 -0400 Subject: [PATCH] Fix potential race condition. I guess. --- .../main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 977985df7..438c43cbd 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -316,15 +316,16 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean equals(Object other) { - if (worldRef.get() == null) { + final World ref = worldRef.get(); + if (ref == null) { return false; } else if (other == null) { return false; } else if ((other instanceof BukkitWorld)) { World otherWorld = ((BukkitWorld) other).worldRef.get(); - return otherWorld != null && otherWorld.equals(getWorld()); + return ref.equals(otherWorld); } else if (other instanceof com.sk89q.worldedit.world.World) { - return ((com.sk89q.worldedit.world.World) other).getName().equals(getName()); + return ((com.sk89q.worldedit.world.World) other).getName().equals(ref.getName()); } else { return false; }