summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/bukkit/Location.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 4afabd88..3760f5a2 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/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());
}