Commit 400b0d7e authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈 Committed by Aleix Pol Gonzalez

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:
parent 48ff95b8
...@@ -221,7 +221,8 @@ void KNSBackend::receivedEntries(const KNSCore::EntryInternal::List& entries) ...@@ -221,7 +221,8 @@ void KNSBackend::receivedEntries(const KNSCore::EntryInternal::List& entries)
{ {
m_responsePending = false; 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()) { if (!resources.isEmpty()) {
Q_EMIT receivedResources(resources); Q_EMIT receivedResources(resources);
} else { } 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