Guard against NPE when getting real IP

This commit is contained in:
md_5 2013-05-19 17:58:42 +10:00
parent 9b7d8d544e
commit 694dfbd313

View File

@ -1,4 +1,4 @@
From 7ba79caac4ca9b248fe29b48ef6852db5c19fd13 Mon Sep 17 00:00:00 2001
From 391c4be8c84b3e1220a84b4878b2be67b143d62a Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 11:15:11 +1100
Subject: [PATCH] BungeeCord Support
@ -79,7 +79,7 @@ index fed3181..a0c66d8 100644
if (metrics == null) {
try {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0b5ea21..fa9b9f1 100644
index 0b5ea21..26cb661 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1012,4 +1012,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -89,7 +89,7 @@ index 0b5ea21..fa9b9f1 100644
+
+ // Spigot start
+ public InetSocketAddress getRawAddress() {
+ return (InetSocketAddress) this.getHandle().playerConnection.networkManager.getSocket().getRemoteSocketAddress();
+ return (getHandle().playerConnection == null) ? null : (InetSocketAddress) getHandle().playerConnection.networkManager.getSocket().getRemoteSocketAddress();
+ }
+ // Spigot end
}