Skip to content

Commit 55e3fcf

Browse files
committed
refactor: 增加赋值逻辑判断
1 parent 5caf279 commit 55e3fcf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/extensions/BootstrapBlazor.Socket/DataConverter/DataConverter.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ protected virtual bool Parse(ReadOnlyMemory<byte> data, TEntity entity)
6161
?? GetPropertyConverterAttribute(p);
6262
if (attr != null)
6363
{
64-
p.SetValue(entity, attr.ConvertTo(data));
64+
var v = attr.ConvertTo(data);
65+
if (v?.GetType() == attr.Type)
66+
{
67+
p.SetValue(entity, v);
68+
}
6569
}
6670
}
6771
ret = true;

0 commit comments

Comments
 (0)