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
parent cae4d39a86
commit 9f99484347

View File

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