From 327b8d43a84ac9707f677bc6f459b8c68ce141f0 Mon Sep 17 00:00:00 2001 From: heavyrian2012 Date: Wed, 15 Nov 2023 10:21:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=9F=90=E4=BA=9B=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E6=83=85=E5=86=B5=E4=B8=8B=E8=8E=B7=E5=8F=96=E7=BD=91?= =?UTF-8?q?=E5=8D=A1=E4=BF=A1=E6=81=AF=E5=A4=B1=E8=B4=A5=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- broker/src/main/java/io/moquette/server/Server.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/broker/src/main/java/io/moquette/server/Server.java b/broker/src/main/java/io/moquette/server/Server.java index 6d0b3017..a1581cb1 100755 --- a/broker/src/main/java/io/moquette/server/Server.java +++ b/broker/src/main/java/io/moquette/server/Server.java @@ -357,7 +357,11 @@ public class Server { private String getServerIp(IConfig config) { String serverIp = config.getProperty(BrokerConstants.SERVER_IP_PROPERTY_NAME); if (serverIp == null || serverIp.equals("0.0.0.0")) { - serverIp = Utility.getLocalAddress().getHostAddress(); + if(Utility.getLocalAddress() != null) { + serverIp = Utility.getLocalAddress().getHostAddress(); + } else { + serverIp = "0.0.0.0"; + } } return serverIp; }