From a4df84f78552510a157a1bad85c13562479b76c0 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 20 Oct 2022 11:26:46 +0200 Subject: [PATCH] fixed: guard against invalid dereference in getRho --- opm/simulators/wells/StandardWellGeneric.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opm/simulators/wells/StandardWellGeneric.hpp b/opm/simulators/wells/StandardWellGeneric.hpp index 812b07f63..4cd02f783 100644 --- a/opm/simulators/wells/StandardWellGeneric.hpp +++ b/opm/simulators/wells/StandardWellGeneric.hpp @@ -106,7 +106,10 @@ protected: mutable BVectorWell Bx_; mutable BVectorWell invDrw_; - double getRho() const { return perf_densities_[0]; } + double getRho() const + { + return this->perf_densities_.empty() ? 0.0 : perf_densities_[0]; + } }; }