Commit 6f3a9d68 authored by Michael Ott's avatar Michael Ott
Browse files

Fix DCDBQuery::execute() to not remove elements from the query prematurely

parent 99d31977
......@@ -425,6 +425,11 @@ void DCDBQuery::execute() {
std::list<DCDB::SensorDataStoreReading> results;
DCDB::Sensor sensor(connection, q->first);
// Move iterator to the next element now, because we may remove the current element below and invalidate the iterator
if (q != queries.end()) {
q++;
}
// Query aggregates first
auto it=range.first;
while(it!=range.second) {
......@@ -437,9 +442,6 @@ void DCDBQuery::execute() {
if (it == range.first) {
range.first = std::next(it);
}
if (it == q) {
q = std::next(q);
}
it = queries.erase(it);
continue;
}
......@@ -461,9 +463,6 @@ void DCDBQuery::execute() {
results.clear();
}
}
if (q != queries.end()) {
q++;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment