diff --git a/components/tachart/tatransformations.pas b/components/tachart/tatransformations.pas index 3452d2e7ec..581149afd5 100644 --- a/components/tachart/tatransformations.pas +++ b/components/tachart/tatransformations.pas @@ -683,6 +683,12 @@ end; procedure TAutoScaleAxisTransform.ClearBounds; begin inherited ClearBounds; + + // Avoid crashing when called too early, e.g. when a TNavPanel is on the form + // https://forum.lazarus.freepascal.org/index.php/topic,47429.0.html + if FDrawData = nil then + exit; + with TAutoScaleTransformData(FDrawData) do begin FMin := SafeInfinity; FMax := NegInfinity;