avoid derefing out-of-bounds if there are no alqs

This commit is contained in:
Arne Morten Kvarving 2024-04-02 16:43:02 +02:00
parent cecedc1042
commit ba96a94277

View File

@ -863,7 +863,7 @@ void WellState::communicateGroupRates(const Comm& comm)
data[pos++] = 0;
}
}
if (!data.empty()) {
if (!data.empty() && pos != sz) {
pos += this->alq_state.pack_data(&data[pos]);
}
assert(pos == sz);
@ -879,7 +879,7 @@ void WellState::communicateGroupRates(const Comm& comm)
for (auto& value : rates)
value = data[pos++];
}
if (!data.empty()) {
if (!data.empty() && pos != sz) {
pos += this->alq_state.unpack_data(&data[pos]);
}
assert(pos == sz);