TAChart: Fix crash when using TChartExtentLink with LinkedChart.Chart = nil

git-svn-id: trunk@38710 -
This commit is contained in:
ask 2012-09-17 07:43:14 +00:00
parent 8870f3c68e
commit fcf2372934

View File

@ -128,23 +128,24 @@ procedure TChartExtentLink.SyncWith(AChart: TChart);
var
c: TCollectionItem;
ch: TChart;
begin
if not FEnabled or (AChart = nil) then exit;
for c in LinkedCharts do
with TLinkedChart(c).Chart do begin
// Do not sync if the chart was never drawn yet.
if LogicalExtent = EmptyExtent then continue;
// An event loop will be broken since setting LogicalExtent to
// the same value does not initiale the extent broadcast.
case Mode of
elmXY:
LogicalExtent := AChart.LogicalExtent;
elmOnlyX:
LogicalExtent := CombineXY(AChart.LogicalExtent, LogicalExtent);
elmOnlyY:
LogicalExtent := CombineXY(LogicalExtent, AChart.LogicalExtent);
end;
for c in LinkedCharts do begin
ch := TLinkedChart(c).Chart;
// Do not sync if the chart was never drawn yet.
if (ch = nil) or (ch.LogicalExtent = EmptyExtent) then continue;
// An event loop will be broken since setting LogicalExtent to
// the same value does not initiale the extent broadcast.
case Mode of
elmXY:
ch.LogicalExtent := AChart.LogicalExtent;
elmOnlyX:
ch.LogicalExtent := CombineXY(AChart.LogicalExtent, ch.LogicalExtent);
elmOnlyY:
ch.LogicalExtent := CombineXY(ch.LogicalExtent, AChart.LogicalExtent);
end;
end;
end;
end.