diff --git a/dumux/material/components/tabulatedcomponent.hh b/dumux/material/components/tabulatedcomponent.hh index f769df9cd2f2502d922a70a7715b3513898736ae..5728d403e6f9a4ff1ff14b1cb992b9d0da795170 100644 --- a/dumux/material/components/tabulatedcomponent.hh +++ b/dumux/material/components/tabulatedcomponent.hh @@ -951,9 +951,9 @@ private: const GetPIdx& getPIdx, const MinPFunc& minP, const MaxPFunc& maxP) { Scalar alphaT = tempIdx_(T); - if (alphaT < 0 || alphaT >= nTemp_ - 1) { + if (alphaT < 0 || alphaT >= nTemp_ - 1) return std::numeric_limits<Scalar>::quiet_NaN(); - } + using std::clamp; const auto iT = clamp<int>(static_cast<int>(alphaT), 0, nTemp_ - 2); alphaT -= iT; @@ -990,6 +990,9 @@ private: { using std::clamp; Scalar alphaT = tempIdx_(T); + if (alphaT < 0 || alphaT >= nTemp_ - 1) + return std::numeric_limits<Scalar>::quiet_NaN(); + const auto iT = clamp<int>(static_cast<int>(alphaT), 0, nTemp_ - 2); alphaT -= iT;