[bugfix] Do not unconditionally dereference std::optional.

In WellGroupHelpers we unconditional referenced the region
member of GPMaint. Unfortunately, that is a std:optional and
doing this can create quite some havoc.

Now we stop processing if it is unset.
This commit is contained in:
Markus Blatt 2022-11-09 16:49:07 +01:00
parent d8c0057601
commit 9cb6d53dcb

View File

@ -682,7 +682,11 @@ namespace WellGroupHelpers
if (!gpm)
return;
const auto [name, number] = *gpm->region();
const auto& region = gpm->region();
if (!region)
return;
const auto [name, number] = *region;
const double error = gpm->pressure_target() - regional_values.pressure(number);
double current_rate = 0.0;
const auto& pu = well_state.phaseUsage();