From 48a07c9bb8be786db0ef280c3a478898ce10fccd Mon Sep 17 00:00:00 2001 From: wp Date: Sat, 6 Apr 2019 08:24:27 +0000 Subject: [PATCH] TAChart: Check value for NaN BEFORE setting in x-sorted ListChartSource (instead of AFTER). Issue #35188, patch by Marcin Wiazowski. git-svn-id: trunk@60856 - --- components/tachart/tasources.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/tachart/tasources.pas b/components/tachart/tasources.pas index 59e2dac487..d8ff8b4d27 100644 --- a/components/tachart/tasources.pas +++ b/components/tachart/tasources.pas @@ -743,14 +743,15 @@ var end; begin + if Sorted then + if IsNan(AValue) then + raise EChartError.CreateFmt('X = NaN in sorted source %s', [NameOrClassName(Self)]); oldX := Item[AIndex]^.X; Result := AIndex; if IsEquivalent(oldX, AValue) then exit; Item[AIndex]^.X := AValue; UpdateExtent; if Sorted then begin - if IsNan(AValue) then - raise EChartError.CreateFmt('X = NaN in sorted source %s', [NameOrClassName(Self)]); if AValue > oldX then while (Result < Count - 1) and (Item[Result + 1]^.X < AValue) do Inc(Result)