diff --git a/ide/projecticon.pas b/ide/projecticon.pas index 131d0d6f9c..5c92ea4a6e 100644 --- a/ide/projecticon.pas +++ b/ide/projecticon.pas @@ -177,6 +177,7 @@ var begin Result := False; if IsEmpty then exit; + //debugln(['TProjectIcon.CreateIconFile ',FIcoFileName]); try if FileExistsUTF8(FIcoFileName) then fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenWrite) @@ -207,6 +208,7 @@ procedure TProjectIcon.SetIsEmpty(const AValue: Boolean); var NewData: TIconData; fs: TFileStreamUTF8; + ok: Boolean; begin if IsEmpty=AValue then exit; if AValue then @@ -214,7 +216,7 @@ begin else begin // We need to restore data from the .ico file - IconData := nil; + ok:=false; try fs:=TFileStreamUTF8.Create(FIcoFileName,fmOpenRead); try @@ -222,11 +224,14 @@ begin if length(NewData)>0 then fs.Read(NewData[0],length(NewData)); IconData := NewData; + ok:=true; finally fs.Free end; except end; + if not ok then + IconData:=nil; end; Modified := True; end;