From 1a355b26cdaf37bd5c3246c2fb4b87dec587de6e Mon Sep 17 00:00:00 2001 From: tanliansheng Date: Tue, 4 Apr 2023 16:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E8=AF=81=E6=8B=BF=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E9=9B=86=E5=90=88=E4=B8=AD=E6=B2=A1=E6=9C=89null=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/crazycake/shiro/RedisSessionDAO.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/crazycake/shiro/RedisSessionDAO.java b/src/main/java/org/crazycake/shiro/RedisSessionDAO.java index 69220c68..6069a85b 100644 --- a/src/main/java/org/crazycake/shiro/RedisSessionDAO.java +++ b/src/main/java/org/crazycake/shiro/RedisSessionDAO.java @@ -150,8 +150,11 @@ public Collection getActiveSessions() { Set keys = redisManager.keys(keySerializer.serialize(this.keyPrefix + "*")); if (keys != null && keys.size() > 0) { for (byte[] key:keys) { - Session s = (Session) valueSerializer.deserialize(redisManager.get(key)); - sessions.add(s); + Object deserialize = valueSerializer.deserialize(redisManager.get(key)); + if (deserialize == null) { + continue; + } + sessions.add((Session) deserialize); } } } catch (SerializationException e) {