TAChart: Fix crash when unsorted data are entered into DataPointsEditor for a sorted chartsource

git-svn-id: trunk@62289 -
This commit is contained in:
wp 2019-11-23 22:26:40 +00:00
parent 7b46b7ced2
commit 4c785559bb

View File

@ -78,18 +78,23 @@ function DataPointsEditor(AListChartSource: TListChartsource;
AOptions: TDataPointsEditorOptions = []): Boolean;
var
F: TDataPointsEditorForm;
wasSorted: Boolean;
begin
Result := false;
F := TDataPointsEditorForm.Create(Application);
try
wasSorted := AListChartSource.Sorted;
AListChartSource.Sorted := false;
F.InitData(
AListChartSource.XCount,
AListChartSource.YCount,
AListChartSource.DataPoints,
AOptions
);
if F.ShowModal = mrOK then
if F.ShowModal = mrOK then begin
F.ExtractData(Result);
if wasSorted then AListChartSource.Sorted := true;
end;
finally
F.Free;
end;