Skip to content

Commit

Permalink
[fix]修正XmlConfig保存配置文件错误,错误判空导致未能正确写入配置类中的空属性。尽管XmlConfig已经过期多年,但一些老项…
Browse files Browse the repository at this point in the history
…目仍然在使用。
  • Loading branch information
nnhy committed Apr 17, 2024
1 parent 52c5746 commit c5ba71c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions NewLife.Core/Serialization/Xml/Xml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ public Boolean Write(Object? value, String? name = null, Type? type = null)
var rs = WriteStart(type);
try
{
if (rs && value != null)
if (rs /*&& value != null*/)
{
foreach (var item in Handlers)
{
if (item.Write(value, type)) return true;
}

writer.WriteValue(value);
if (value != null)
writer.WriteValue(value);

return true;
}

return false;
Expand Down

0 comments on commit c5ba71c

Please sign in to comment.