diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-17 15:16:29 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-17 15:16:29 +0200 |
commit | 93c9ebb5d0654626cb8bf2e6b00a5845b210f82c (patch) | |
tree | d333bf90e2a2e25c43b1bc6f514a8df5efa6c38f /common/datastorequery.cpp | |
parent | 493aae46b3aeffcdb001f697efdc5a42eba672d8 (diff) | |
download | sink-93c9ebb5d0654626cb8bf2e6b00a5845b210f82c.tar.gz sink-93c9ebb5d0654626cb8bf2e6b00a5845b210f82c.zip |
Fixed a readEntity call with empty uid
Filtered entites are still passed through as removal, but if
there is no other value for the reduction, the reduction result is
empty.
Diffstat (limited to 'common/datastorequery.cpp')
-rw-r--r-- | common/datastorequery.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/datastorequery.cpp b/common/datastorequery.cpp index b77dfc9..276a10a 100644 --- a/common/datastorequery.cpp +++ b/common/datastorequery.cpp | |||
@@ -327,6 +327,10 @@ public: | |||
327 | mReducedValues.insert(reductionValueBa); | 327 | mReducedValues.insert(reductionValueBa); |
328 | auto reductionResult = reduceOnValue(reductionValue); | 328 | auto reductionResult = reduceOnValue(reductionValue); |
329 | 329 | ||
330 | //This can happen if we get a removal message from a filtered entity and all entites of the reduction are filtered. | ||
331 | if (reductionResult.selection.isEmpty()) { | ||
332 | return; | ||
333 | } | ||
330 | mSelectedValues.insert(reductionValueBa, reductionResult.selection); | 334 | mSelectedValues.insert(reductionValueBa, reductionResult.selection); |
331 | readEntity(reductionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation operation) { | 335 | readEntity(reductionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation operation) { |
332 | callback({entity, operation, reductionResult.aggregateValues, reductionResult.aggregateIds}); | 336 | callback({entity, operation, reductionResult.aggregateValues, reductionResult.aggregateIds}); |
@@ -345,11 +349,13 @@ public: | |||
345 | auto oldSelectionResult = mSelectedValues.take(reductionValueBa); | 349 | auto oldSelectionResult = mSelectedValues.take(reductionValueBa); |
346 | if (oldSelectionResult == selectionResult.selection) { | 350 | if (oldSelectionResult == selectionResult.selection) { |
347 | mSelectedValues.insert(reductionValueBa, selectionResult.selection); | 351 | mSelectedValues.insert(reductionValueBa, selectionResult.selection); |
352 | Q_ASSERT(!selectionResult.selection.isEmpty()); | ||
348 | readEntity(selectionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { | 353 | readEntity(selectionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { |
349 | callback({entity, Sink::Operation_Modification, selectionResult.aggregateValues, selectionResult.aggregateIds}); | 354 | callback({entity, Sink::Operation_Modification, selectionResult.aggregateValues, selectionResult.aggregateIds}); |
350 | }); | 355 | }); |
351 | } else { | 356 | } else { |
352 | //remove old result | 357 | //remove old result |
358 | Q_ASSERT(!oldSelectionResult.isEmpty()); | ||
353 | readEntity(oldSelectionResult, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { | 359 | readEntity(oldSelectionResult, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { |
354 | callback({entity, Sink::Operation_Removal}); | 360 | callback({entity, Sink::Operation_Removal}); |
355 | }); | 361 | }); |
@@ -358,6 +364,7 @@ public: | |||
358 | if (!selectionResult.selection.isEmpty()) { | 364 | if (!selectionResult.selection.isEmpty()) { |
359 | //add new result | 365 | //add new result |
360 | mSelectedValues.insert(reductionValueBa, selectionResult.selection); | 366 | mSelectedValues.insert(reductionValueBa, selectionResult.selection); |
367 | Q_ASSERT(!selectionResult.selection.isEmpty()); | ||
361 | readEntity(selectionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { | 368 | readEntity(selectionResult.selection, [&](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation) { |
362 | callback({entity, Sink::Operation_Creation, selectionResult.aggregateValues, selectionResult.aggregateIds}); | 369 | callback({entity, Sink::Operation_Creation, selectionResult.aggregateValues, selectionResult.aggregateIds}); |
363 | }); | 370 | }); |