From 29cca3919ed373c486c3c9acec32481918baeb58 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 13 Jun 2016 09:48:24 +0200 Subject: Don't match invalid properties. --- common/entityreader.cpp | 12 ++++-------- 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::getFilter(const QSet remainingFilters, con } for (const auto &filterProperty : remainingFilters) { const auto property = domainObject->getProperty(filterProperty); - if (property.isValid()) { - const auto comparator = query.propertyFilter.value(filterProperty); - if (!comparator.matches(property)) { - Trace() << "Filtering entity due to property mismatch on filter: " << filterProperty << property << ":" << comparator.value; - return false; - } - } else { - Warning() << "Ignored property filter because value is invalid: " << filterProperty; + const auto comparator = query.propertyFilter.value(filterProperty); + if (!comparator.matches(property)) { + Trace() << "Filtering entity due to property mismatch on filter: " << filterProperty << property << ":" << comparator.value; + return false; } } 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 { switch(comparator) { case Equals: + if (!v.isValid()) { + return false; + } return v == value; case Contains: + if (!v.isValid()) { + return false; + } return v.value().contains(value.toByteArray()); default: break; -- cgit v1.2.3