From d650914a3fb2f95fec46ad18f0413c04e11ea6f7 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 13 May 2019 15:43:06 +0000 Subject: [PATCH] fpspreadsheet: Fix crash in the biff8 reader's FreeSharedStringTable when no SST is used. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6912 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/source/common/xlsbiff8.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/fpspreadsheet/source/common/xlsbiff8.pas b/components/fpspreadsheet/source/common/xlsbiff8.pas index 1d68a6253..34c231ca3 100644 --- a/components/fpspreadsheet/source/common/xlsbiff8.pas +++ b/components/fpspreadsheet/source/common/xlsbiff8.pas @@ -816,15 +816,17 @@ end; {@@ ---------------------------------------------------------------------------- Frees the shared string table. Also: destroys the rich-text memory streams - which can be assigned to string table items. + which may be assigned to string table items. -------------------------------------------------------------------------------} procedure TsSpreadBIFF8Reader.FreeSharedStringTable; var j: Integer; begin - for j := 0 to FSharedStringTable.Count-1 do - TObject(FSharedStringTable.Objects[j]).Free; - FreeAndNil(FSharedStringTable); + if FSharedStringTable <> nil then begin + for j := 0 to FSharedStringTable.Count-1 do + TObject(FSharedStringTable.Objects[j]).Free; + FreeAndNil(FSharedStringTable); + end; end; {@@ ----------------------------------------------------------------------------