From 64592d9fcf9fe1e68481c98afe9b544962d24dfd Mon Sep 17 00:00:00 2001 From: Vladislav Romashko Date: Thu, 26 Feb 2026 11:35:08 +0000 Subject: [PATCH] Foundation Classes, math_FunctionRoot - Constructor exception (#1121) - Guarded `Sol.NbIterations()` calls with `if (Done)` in both `math_FunctionRoot` constructors. - Prevents `StdFail_NotDone` from being raised during construction when the root is not found. --- src/FoundationClasses/TKMath/math/math_FunctionRoot.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FoundationClasses/TKMath/math/math_FunctionRoot.cxx b/src/FoundationClasses/TKMath/math/math_FunctionRoot.cxx index cec6c1e601..cef7df76e0 100644 --- a/src/FoundationClasses/TKMath/math/math_FunctionRoot.cxx +++ b/src/FoundationClasses/TKMath/math/math_FunctionRoot.cxx @@ -81,10 +81,10 @@ math_FunctionRoot::math_FunctionRoot(math_FunctionWithDerivative& F, Tol(1) = Tolerance; math_FunctionSetRoot Sol(Ff, Tol, NbIterations); Sol.Perform(Ff, V); - Done = Sol.IsDone(); - NbIter = Sol.NbIterations(); + Done = Sol.IsDone(); if (Done) { + NbIter = Sol.NbIterations(); F.GetStateNumber(); TheRoot = Sol.Root()(1); TheDerivative = Sol.Derivative()(1, 1); @@ -107,10 +107,10 @@ math_FunctionRoot::math_FunctionRoot(math_FunctionWithDerivative& F, Bb(1) = B; math_FunctionSetRoot Sol(Ff, Tol, NbIterations); Sol.Perform(Ff, V, Aa, Bb); - Done = Sol.IsDone(); - NbIter = Sol.NbIterations(); + Done = Sol.IsDone(); if (Done) { + NbIter = Sol.NbIterations(); F.GetStateNumber(); TheRoot = Sol.Root()(1); TheDerivative = Sol.Derivative()(1, 1);