diff options
-rw-r--r-- | common/entityreader.cpp | 12 | ||||
-rw-r--r-- | common/query.cpp | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/common/entityreader.cpp b/common/entityreader.cpp index a3ca8e2..c15f73f 100644 --- a/common/entityreader.cpp +++ b/common/entityreader.cpp | |||
@@ -375,14 +375,10 @@ EntityReader<DomainType>::getFilter(const QSet<QByteArray> remainingFilters, con | |||
375 | } | 375 | } |
376 | for (const auto &filterProperty : remainingFilters) { | 376 | for (const auto &filterProperty : remainingFilters) { |
377 | const auto property = domainObject->getProperty(filterProperty); | 377 | const auto property = domainObject->getProperty(filterProperty); |
378 | if (property.isValid()) { | 378 | const auto comparator = query.propertyFilter.value(filterProperty); |
379 | const auto comparator = query.propertyFilter.value(filterProperty); | 379 | if (!comparator.matches(property)) { |
380 | if (!comparator.matches(property)) { | 380 | Trace() << "Filtering entity due to property mismatch on filter: " << filterProperty << property << ":" << comparator.value; |
381 | Trace() << "Filtering entity due to property mismatch on filter: " << filterProperty << property << ":" << comparator.value; | 381 | return false; |
382 | return false; | ||
383 | } | ||
384 | } else { | ||
385 | Warning() << "Ignored property filter because value is invalid: " << filterProperty; | ||
386 | } | 382 | } |
387 | } | 383 | } |
388 | return true; | 384 | return true; |
diff --git a/common/query.cpp b/common/query.cpp index 5f93c82..75d2a2e 100644 --- a/common/query.cpp +++ b/common/query.cpp | |||
@@ -50,8 +50,14 @@ bool Query::Comparator::matches(const QVariant &v) const | |||
50 | { | 50 | { |
51 | switch(comparator) { | 51 | switch(comparator) { |
52 | case Equals: | 52 | case Equals: |
53 | if (!v.isValid()) { | ||
54 | return false; | ||
55 | } | ||
53 | return v == value; | 56 | return v == value; |
54 | case Contains: | 57 | case Contains: |
58 | if (!v.isValid()) { | ||
59 | return false; | ||
60 | } | ||
55 | return v.value<QByteArrayList>().contains(value.toByteArray()); | 61 | return v.value<QByteArrayList>().contains(value.toByteArray()); |
56 | default: | 62 | default: |
57 | break; | 63 | break; |