From d03379a043b9a8a8fca884071c3eb3f36080ebe5 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 10 Jan 2012 00:20:03 -0500 Subject: [PATCH] Further fix to Location. By: Tahg --- paper-api/src/main/java/org/bukkit/Location.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/Location.java b/paper-api/src/main/java/org/bukkit/Location.java index 4afabd8873..3760f5a207 100644 --- a/paper-api/src/main/java/org/bukkit/Location.java +++ b/paper-api/src/main/java/org/bukkit/Location.java @@ -373,8 +373,10 @@ public class Location implements Cloneable { */ public double distanceSquared(Location o) { if (o == null) { + throw new IllegalArgumentException("Cannot measure distance to a null location"); + } else if (o.getWorld() == null || getWorld() == null) { throw new IllegalArgumentException("Cannot measure distance to a null world"); - } else if (o == null || o.getWorld() != getWorld()) { + } else if (o.getWorld() != getWorld()) { throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName()); }