From fd7767d3228c997e08479d14d1d3054bf2b6e220 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Tue, 11 Oct 2022 18:54:33 +0200
Subject: [PATCH] [tabcomp] Unify checks

---
 dumux/material/components/tabulatedcomponent.hh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dumux/material/components/tabulatedcomponent.hh b/dumux/material/components/tabulatedcomponent.hh
index f769df9cd2..5728d403e6 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;
 
-- 
GitLab