mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-02 00:29:25 +02:00
TAChart: Fix TFuncSeries crashing at runtime when no OnCalculate handler is assigned. Issue #35200.
git-svn-id: trunk@60609 -
This commit is contained in:
parent
b4aa5c80f3
commit
f520fd4ad5
@ -83,9 +83,6 @@ type
|
||||
public
|
||||
procedure Assign(ASource: TPersistent); override;
|
||||
procedure Draw(ADrawer: IChartDrawer); override;
|
||||
function GetNearestPoint(
|
||||
const AParams: TNearestPointParams;
|
||||
out AResults: TNearestPointResults): Boolean; override;
|
||||
function IsEmpty: Boolean; override;
|
||||
published
|
||||
property OnCalculate: TFuncCalculateEvent
|
||||
@ -647,7 +644,7 @@ var
|
||||
ymin, ymax: Double;
|
||||
begin
|
||||
inherited GetBounds(ABounds);
|
||||
if not Extent.UseXMin or not Extent.UseXMax or not ExtentAutoY then
|
||||
if not Extent.UseXMin or not Extent.UseXMax or not ExtentAutoY or IsEmpty then
|
||||
exit;
|
||||
ymin := SafeInfinity;
|
||||
ymax := NegInfinity;
|
||||
@ -672,6 +669,10 @@ function TCustomFuncSeries.GetNearestPoint(
|
||||
const AParams: TNearestPointParams;
|
||||
out AResults: TNearestPointResults): Boolean;
|
||||
begin
|
||||
if IsEmpty then begin
|
||||
AResults.FIndex := -1;
|
||||
exit(false);
|
||||
end;
|
||||
with TDrawFuncHelper.Create(Self, DomainExclusions, @DoCalculate, Step) do
|
||||
try
|
||||
Result := GetNearestPoint(AParams, AResults);
|
||||
@ -750,16 +751,6 @@ begin
|
||||
inherited GetBounds(ABounds);
|
||||
end;
|
||||
|
||||
function TFuncSeries.GetNearestPoint(
|
||||
const AParams: TNearestPointParams;
|
||||
out AResults: TNearestPointResults): Boolean;
|
||||
begin
|
||||
AResults.FIndex := -1;
|
||||
if not Assigned(OnCalculate) then
|
||||
exit(false);
|
||||
Result := inherited;
|
||||
end;
|
||||
|
||||
function TFuncSeries.IsEmpty: Boolean;
|
||||
begin
|
||||
Result := not Assigned(OnCalculate);
|
||||
|
Loading…
Reference in New Issue
Block a user