From 44bb1203acdaac301541e429e7e9fbc0512d41b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=BA=E8=83=BD=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Fri, 2 May 2025 09:23:24 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20GetAll=E8=BF=94=E5=9B=9E=E7=A9=BA?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8C=E5=87=BA=E7=8E=B0=E8=BF=99=E7=A7=8D?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=8C=E6=9B=B4=E5=8F=AF=E8=83=BD=E6=98=AF?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=BA=95=E5=B1=82=E8=BF=94=E5=9B=9E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BC=82=E5=B8=B8=E3=80=82fix:=20https://github.com/N?= =?UTF-8?q?ewLifeX/NewLife.Redis/issues/154?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NewLife.Redis/RedisHash.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NewLife.Redis/RedisHash.cs b/NewLife.Redis/RedisHash.cs index 14f531e..4b40948 100644 --- a/NewLife.Redis/RedisHash.cs +++ b/NewLife.Redis/RedisHash.cs @@ -151,9 +151,9 @@ public class RedisHash : RedisBase, IDictionary /// 获取所有名值对 /// - public IDictionary GetAll() + public IDictionary GetAll() { - var dic = new Dictionary(); + var dic = new Dictionary(); var rs = Execute((r, k) => r.Execute("HGETALL", Key)); if (rs == null || rs.Length == 0) return dic; @@ -163,7 +163,7 @@ public class RedisHash : RedisBase, IDictionary var pk2 = rs[++i]; var key = Redis.Encoder.Decode(pk); var value = Redis.Encoder.Decode(pk2); - dic[key] = value; + if (key != null) dic[key] = value; } if (typeof(TKey) != typeof(IPacket) && typeof(TValue) != typeof(IPacket)) rs.TryDispose();