fix segfault when no well report is registred

This commit is contained in:
Tor Harald Sandve 2019-06-03 08:48:21 +02:00
parent 2cc22f99cb
commit 4c4921c6b2

View File

@ -491,7 +491,14 @@ namespace Opm {
std::ostringstream msg;
msg << " Excessive chopping detected in report step "
<< sr.back().report_step << ", substep " << sr.back().current_step << "\n";
assert(!sr.back().report.empty());
std::set<std::string> failing_wells;
// return empty set if no report exists
// well failures in assembly is not yet registred
if(sr.back().report.empty())
return failing_wells;
const auto& wfs = sr.back().report.back().wellFailures();
for (const auto& wf : wfs) {
msg << " Well that failed: " << wf.wellName() << "\n";
@ -504,7 +511,6 @@ namespace Opm {
const int rep_step = sr.back().report_step;
const int sub_step = sr.back().current_step;
const int sr_size = sr.size();
std::set<std::string> failing_wells;
for (const auto& wf : wfs) {
failing_wells.insert(wf.wellName());
}