From 262d06ea3ac284e36d880026743d9a5c03414bb5 Mon Sep 17 00:00:00 2001 From: TwelveT <2471835953@qq.com> Date: Fri, 19 Mar 2021 14:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=82=E6=AD=A5=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=AF=BC=E8=87=B4=E7=9A=84request=20null,IP=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/core/utils/ip/IpUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ip/IpUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ip/IpUtils.java index be8712f47..dd67c9277 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ip/IpUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ip/IpUtils.java @@ -14,6 +14,11 @@ public class IpUtils { public static String getIpAddr(HttpServletRequest request) { + + if(request == null){ + return null; + } + String ip = null; // X-Forwarded-For:Squid 服务代理