From 76df332b578f42c256c007405443f09d0ebcf98b Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sat, 5 Feb 2022 11:51:54 +0000 Subject: [PATCH] Check for null IP address before notifying of an external IP update. --- src/main/java/org/qortal/network/Network.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/qortal/network/Network.java b/src/main/java/org/qortal/network/Network.java index 2f5d9bd9..2a25864a 100644 --- a/src/main/java/org/qortal/network/Network.java +++ b/src/main/java/org/qortal/network/Network.java @@ -1164,11 +1164,13 @@ public class Network { if (consecutiveReadings >= consecutiveReadingsRequired) { // Last 10 readings were the same - i.e. more than one peer agreed on the new IP address... String ip = ipAddressHistory.get(size - 1); - if (!Objects.equals(ip, this.ourExternalIpAddress)) { - // ... and the readings were different to our current recorded value, so - // update our external IP address value - this.ourExternalIpAddress = ip; - this.onExternalIpUpdate(ip); + if (ip != null && !Objects.equals(ip, "null")) { + if (!Objects.equals(ip, this.ourExternalIpAddress)) { + // ... and the readings were different to our current recorded value, so + // update our external IP address value + this.ourExternalIpAddress = ip; + this.onExternalIpUpdate(ip); + } } } }