Merge pull request #4259 from blattms/do-dereference-unset-optional

[bugfix] Do not unconditionally dereference std::optional.
This commit is contained in:
Markus Blatt 2022-11-22 10:26:30 +01:00 committed by GitHub
commit 58d8ca144e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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