TAChart: Fix crash in stacked bar series due to dd3322cfc0

This commit is contained in:
wp_xyz 2023-12-03 23:17:21 +01:00
parent 68acca089e
commit ebd45b7c62

View File

@ -1429,10 +1429,14 @@ begin
FCumulativeExtentIsValid := false; FCumulativeExtentIsValid := false;
FXListExtentIsValid := false; FXListExtentIsValid := false;
FYListExtentIsValid := false; FYListExtentIsValid := false;
SetLength(FYRangeValid, YCount); if YCount <> MaxInt then
SetLength(FYRange, YCount); begin
for i := 0 to High(FYRange) do SetLength(FYRangeValid, YCount);
FYRangeValid[i] := false; SetLength(FYRange, YCount);
for i := 0 to High(FYRange) do
FYRangeValid[i] := false;
end else
SetLength(FYRangeValid, 0);
end; end;
function TCustomChartSource.IsErrorBarDataStored(AIndex: Integer): Boolean; function TCustomChartSource.IsErrorBarDataStored(AIndex: Integer): Boolean;
@ -1699,7 +1703,7 @@ procedure TCustomChartSource.YRange(AYIndex: Integer; var AMin, AMax: Double);
var var
i, yIdx: Integer; i, yIdx: Integer;
begin begin
if FYRangeValid[AYIndex] then if (AYIndex < Length(FYRangeValid)) and FYRangeValid[AYIndex] then
begin begin
AMin := FYRange[AYIndex].FStart; AMin := FYRange[AYIndex].FStart;
AMax := FYRange[AYIndex].FEnd; AMax := FYRange[AYIndex].FEnd;