summaryrefslogtreecommitdiffstats
path: root/common/datastorequery.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-02-22 13:58:28 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-02-22 13:58:28 +0100
commite5002225dbe4092f5d4e219d8eec7015578f9265 (patch)
treec3881e853d3717efa1a04574d375705eaae68147 /common/datastorequery.cpp
parentc78a085d9b18561fbe763ed1818d0104895b907b (diff)
downloadsink-e5002225dbe4092f5d4e219d8eec7015578f9265.tar.gz
sink-e5002225dbe4092f5d4e219d8eec7015578f9265.zip
Handle the removal of the last item cleanly
Diffstat (limited to 'common/datastorequery.cpp')
-rw-r--r--common/datastorequery.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/datastorequery.cpp b/common/datastorequery.cpp
index dacc8ab..9e61a3d 100644
--- a/common/datastorequery.cpp
+++ b/common/datastorequery.cpp
@@ -345,11 +345,14 @@ public:
345 callback({entity, Sink::Operation_Removal}); 345 callback({entity, Sink::Operation_Removal});
346 }); 346 });
347 347
348 //add new result 348 //If the last item has been removed, then there's nothing to add
349 mSelectedValues.insert(reductionValueBa, selectionResult.selection); 349 if (!selectionResult.selection.isEmpty()) {
350 readEntity(selectionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { 350 //add new result
351 callback({entity, Sink::Operation_Creation, selectionResult.aggregateValues, selectionResult.aggregateIds}); 351 mSelectedValues.insert(reductionValueBa, selectionResult.selection);
352 }); 352 readEntity(selectionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) {
353 callback({entity, Sink::Operation_Creation, selectionResult.aggregateValues, selectionResult.aggregateIds});
354 });
355 }
353 } 356 }
354 } 357 }
355 } 358 }