From 7278467411f7a846dbf4b7fb2233100a81f7dc93 Mon Sep 17 00:00:00 2001 From: shenchunping Date: Thu, 3 Aug 2023 08:27:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DgetLoginId=EF=BC=8C?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=E7=A9=BA=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/dev33/satoken/stp/StpLogic.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/stp/StpLogic.java b/sa-token-core/src/main/java/cn/dev33/satoken/stp/StpLogic.java index 5277099a..97a3f847 100644 --- a/sa-token-core/src/main/java/cn/dev33/satoken/stp/StpLogic.java +++ b/sa-token-core/src/main/java/cn/dev33/satoken/stp/StpLogic.java @@ -994,9 +994,12 @@ public class StpLogic { if(loginId == null) { return defaultValue; } - - // 3、不为 null,则开始尝试类型转换 - return (T)SaFoxUtil.getValueByType(loginId, defaultValue.getClass()); + // 3、不为 null,则开始尝试类型转换 + if (defaultValue != null) { + return (T) SaFoxUtil.getValueByType(loginId, defaultValue.getClass()); + } else { + return (T) SaFoxUtil.getValueByType(loginId, Object.class); + } } /**