mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Crash on colors.json saving
This commit is contained in:
parent
58b1e59967
commit
b908cc031c
1 changed files with 14 additions and 0 deletions
|
|
@ -15,6 +15,8 @@ type
|
|||
private
|
||||
FRoot: TJSONObject;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure SaveToFile(const FileName: String);
|
||||
procedure LoadFromFile(const FileName: String);
|
||||
property Root: TJSONObject read FRoot;
|
||||
|
|
@ -27,6 +29,17 @@ uses
|
|||
|
||||
{ TJsonConfig }
|
||||
|
||||
constructor TJsonConfig.Create;
|
||||
begin
|
||||
FRoot:= TJSONObject.Create;
|
||||
end;
|
||||
|
||||
destructor TJsonConfig.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
FRoot.Free;
|
||||
end;
|
||||
|
||||
procedure TJsonConfig.SaveToFile(const FileName: String);
|
||||
begin
|
||||
with TStringListEx.Create do
|
||||
|
|
@ -44,6 +57,7 @@ var
|
|||
begin
|
||||
AStream:= TFileStreamEx.Create(FileName, fmOpenRead or fmShareDenyNone);
|
||||
try
|
||||
FreeAndNil(FRoot);
|
||||
FRoot:= GetJSON(AStream, True) as TJSONObject;
|
||||
finally
|
||||
AStream.Free;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue