diff --git a/NewLife.Redis/RedisBase.cs b/NewLife.Redis/RedisBase.cs index ab546b3..b25c504 100644 --- a/NewLife.Redis/RedisBase.cs +++ b/NewLife.Redis/RedisBase.cs @@ -79,7 +79,8 @@ protected virtual Packet ToBytes(Object value) if (type == typeof(Byte[])) return pk.ToArray(); if (type.As()) return type.AccessorRead(pk); - var str = pk.ToStr().Trim('\"'); + var str = pk.ToStr() ?? ""; + str = str.Trim('\"'); if (type.GetTypeCode() == TypeCode.String) return str; if (type.GetTypeCode() != TypeCode.Object) return str.ChangeType(type);