From 4001fcffcffe5590f4aee3b63d0c8c5afb489bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Sun, 31 Jul 2022 18:48:09 +0200 Subject: [PATCH] Replace assert() with exception. --- opm/models/discretization/common/tpfalinearizer.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opm/models/discretization/common/tpfalinearizer.hh b/opm/models/discretization/common/tpfalinearizer.hh index 6c6bf4cdc..da5d2bc7d 100644 --- a/opm/models/discretization/common/tpfalinearizer.hh +++ b/opm/models/discretization/common/tpfalinearizer.hh @@ -429,7 +429,9 @@ private: bMat = 0.0; adres = 0.0; const IntensiveQuantities* intQuantsExP = model_().cachedIntensiveQuantities(globJ, /*timeIdx*/ 0); - assert(intQuantsExP); + if (intQuantsExP == nullptr) { + throw std::logic_error("Missing updated intensive quantities for cell " + std::to_string(globJ)); + } const IntensiveQuantities& intQuantsEx = *intQuantsExP; LocalResidual::computeFlux( adres, problem_(), globI, globJ, intQuantsIn, intQuantsEx, 0, nbInfo.trans, nbInfo.faceArea);