IDE: ignore exceptions for invalid project icons

This commit is contained in:
Ondrej Pokorny 2023-01-10 18:57:21 +01:00
parent 77aecca951
commit 3c917017f5
2 changed files with 10 additions and 5 deletions

View File

@ -124,10 +124,12 @@ begin
xIcon := TIcon.Create;
try
xIcon.LoadFromFile(xIconFile);
Result := Images.AddIcon(xIcon);
finally
xIcon.Free;
except
FreeAndNil(xIcon); // ignore exceptions for invalid icons
end;
if Assigned(xIcon) then
Result := Images.AddIcon(xIcon);
xIcon.Free;
end;
xObj := TLoadProjectIconIntoImagesObject.Create;

View File

@ -1700,11 +1700,14 @@ begin
begin
IconStream := LazProject.ProjResources.ProjectIcon.GetStream;
if IconStream<>nil then
begin
try
Icon.LoadFromStream(IconStream);
finally
IconStream.Free;
except
Icon.Clear; // ignore exceptions for invalid icons
end;
IconStream.Free;
end;
end;
end;
end;