diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas index 4e018263f..252add156 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas @@ -1984,7 +1984,7 @@ begin UpdateChart; // Another worksheet is selected --> Select the first chart of the worksheet - if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) then + if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) and (FChart <> nil) then begin charts := WorkbookSource.Worksheet.GetCharts; if Length(charts) > 0 then