Don't accept invalid KNS EntryInternal results

In certain cases we might end up with invalid results being
returned by a KNS source. These entries should be considered
undesirable, and consequently filtered out.

Differential Revision: https://phabricator.kde.org/D18760
parent 56b6f33f
......@@ -209,7 +209,8 @@ void KNSBackend::receivedEntries(const KNSCore::EntryInternal::List& entries)
{
m_responsePending = false;
const auto resources = kTransform<QVector<AbstractResource*>>(entries, [this](const KNSCore::EntryInternal& entry){ return resourceForEntry(entry); });
const auto filtered = kFilter<KNSCore::EntryInternal::List>(entries, [this](const KNSCore::EntryInternal& entry){ return entry.isValid(); });
const auto resources = kTransform<QVector<AbstractResource*>>(filtered, [this](const KNSCore::EntryInternal& entry){ return resourceForEntry(entry); });
if (!resources.isEmpty()) {
Q_EMIT receivedResources(resources);
} else {
......
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