🚨 Free the light config document and tolerate a missing file

LoadConfig leaked the parsed XML document on every call and aborted
startup when the color config file was absent.
This commit is contained in:
2026-11-15 22:08:32 +01:00
parent 043a5a1ccf
commit 93c2af9d9f
+6
View File
@@ -385,7 +385,10 @@ begin
//frmInitialize.SetStatusLabel(Format(frmInitialize.SplashLoading, ['ColorLight.xml'])); //frmInitialize.SetStatusLabel(Format(frmInitialize.SplashLoading, ['ColorLight.xml']));
// Read xml file from your hard drive // Read xml file from your hard drive
if not FileExists(AFileName) then
Exit;
ReadXMLFile(XMLDoc, AFileName); ReadXMLFile(XMLDoc, AFileName);
try
if LowerCase(XMLDoc.DocumentElement.NodeName) = 'colorlight' then if LowerCase(XMLDoc.DocumentElement.NodeName) = 'colorlight' then
begin begin
iNode := XMLDoc.DocumentElement.FirstChild; iNode := XMLDoc.DocumentElement.FirstChild;
@@ -462,6 +465,9 @@ begin
iNode := iNode.NextSibling; iNode := iNode.NextSibling;
end; end;
end; end;
finally
XMLDoc.Free;
end;
end; end;
{ TLightSource } { TLightSource }