Merge pull request #1871 from totto82/fix_segfault

fix segfault when no well report is registred
This commit is contained in:
Atgeirr Flø Rasmussen 2019-06-06 08:57:56 +02:00 committed by GitHub
commit 8ae671eb86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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());
}