Prevent dereferencing the end iterator.

This happened for empty regions and surfaced when compiling
with "-D_GLIBCXX_DEBUG  -DDEBUG -DGLIBCXX_FORCE_NEW".
This commit is contained in:
Markus Blatt 2016-05-06 21:40:33 +02:00 committed by Andreas Lauser
parent 74430caae2
commit f15a78ac9e

View File

@ -264,6 +264,11 @@ namespace Opm
if (deck->hasKeyword("DISGAS")) {
const TableContainer& rsvdTables = tables.getRsvdTables();
for (size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty())
{
rs_func_.push_back(std::shared_ptr<Miscibility::RsVD>());
continue;
}
const int cell = *(eqlmap.cells(i).begin());
if (!rec[i].liveOilInitConstantRs()) {
if (rsvdTables.size() <= 0 ) {
@ -297,6 +302,11 @@ namespace Opm
if (deck->hasKeyword("VAPOIL")) {
const TableContainer& rvvdTables = tables.getRvvdTables();
for (size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty())
{
rv_func_.push_back(std::shared_ptr<Miscibility::RvVD>());
continue;
}
const int cell = *(eqlmap.cells(i).begin());
if (!rec[i].wetGasInitConstantRv()) {
if (rvvdTables.size() <= 0) {
@ -381,6 +391,10 @@ namespace Opm
{
for (const auto& r : reg.activeRegions()) {
const auto& cells = reg.cells(r);
if (cells.empty())
{
continue;
}
const int repcell = *cells.begin();
const RhoCalc calc(props, repcell);