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();