fpspreadsheet: Fix Excel8 reader crashing if file does not contain a FONT record (reported by Malcolm Buckingham on mailing list, Oct 30 2017)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6047 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-10-30 13:08:55 +00:00
parent b35f362f31
commit d62cd79a4c

View File

@ -1263,6 +1263,14 @@ function TsSpreadBIFFReader.FixFontIndex(AFontIndex: Integer): Integer;
var
fnt: TsFont;
begin
// There are some files which do not contain any font records.
// Here we use the predefined DefaultFont of the workbook.
if FFontList.Count = 0 then
begin
Result := 0;
exit;
end;
fnt := TsFont(FFontList[AFontIndex]);
if fnt = nil then // damned font 4!
Result := -1