diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index f17e60165..45e314d55 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -840,8 +840,8 @@ namespace Opm { const auto& perf_data = this->well_perf_data_[wellID]; // Cater for case where local part might have no perforations. - const int pvtreg = perf_data.size() ? - pvt_region_idx_[perf_data.front().cell_index] : 0; + const int pvtreg = perf_data.empty() ? + 0 : pvt_region_idx_[perf_data.front().cell_index]; const auto& parallel_well_info = *local_parallel_well_info_[wellID]; auto global_pvtreg = parallel_well_info.broadcastFirstPerforationValue(pvtreg); diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index 8b6a84e4c..dc87b080b 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -377,8 +377,8 @@ namespace Opm : (prod_controls.cmode == Well::ProducerCMode::GRUP); const double inj_surf_rate = well.isInjector() ? inj_controls.surface_rate : 0.0; // To avoid a "maybe-uninitialized" warning. - const double local_pressure = well_perf_data_[w].size() ? - cellPressures[well_perf_data_[w][0].cell_index] : 0; + const double local_pressure = well_perf_data_[w].empty() ? + 0 : cellPressures[well_perf_data_[w][0].cell_index]; const double global_pressure = well_info.broadcastFirstPerforationValue(local_pressure); if (well.getStatus() == Well::Status::STOP) { // Stopped well: