2
0
Эх сурвалжийг харах

[yaml] write null values to configfile

Exilon 5 жил өмнө
parent
commit
025ceb4613
1 өөрчлөгдсөн 3 нэмэгдсэн , 2 устгасан
  1. 3 2
      Quick.YAML.pas

+ 3 - 2
Quick.YAML.pas

@@ -602,12 +602,13 @@ begin
       if member = nil then continue;
 
       yvalue := member.Value;
-      if yvalue.IsScalar then
+      if (yvalue.IsScalar) or (yvalue is TYamlNull) then
       begin
         if yvalue is TYamlComment then yaml.Writeln(Format('#%s%s',[indent,TYamlComment(member.Value).AsString]))
         else
         begin
-          scalar := member.Value.Value.AsString;
+          if yvalue is TYamlNull then scalar := 'null'
+            else scalar := member.Value.Value.AsString;
           if scalar.IsEmpty then scalar := '""';
           yaml.Writeln(Format('%s%s: %s',[indent,member.Name,scalar]));
           if (i < fMembers.Count - 1) and (fMembers[i+1].Value is TYamlComment) then yaml.Writeln('');