fpspreadsheet: More conservative version of previous commit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9505 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-11-22 18:33:55 +00:00
parent 16e9ab27f1
commit 17132ec44a

View File

@ -1984,14 +1984,15 @@ begin
UpdateChart;
// Another worksheet is selected --> Select the first chart of the worksheet
if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) and (FChart <> nil) then
if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) then
begin
charts := WorkbookSource.Worksheet.GetCharts;
if Length(charts) > 0 then
WorkbookChartIndex := WorkbookSource.Workbook.GetChartIndex(charts[0])
else
WorkbookChartIndex := -1;
FChart.Visible := WorkbookChartIndex > -1;
if Assigned(FChart) then
FChart.Visible := WorkbookChartIndex > -1;
end;
end;