Commit 913afb06 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Don't allow empty searches in debug mode

They are not useful
parent 13d53ae9
......@@ -101,6 +101,8 @@ class DISCOVERCOMMON_EXPORT AbstractResourcesBackend : public QObject
QString origin;
bool allBackends = false;
bool isEmpty() const { return !category && state == AbstractResource::Broken && mimetype.isEmpty() && search.isEmpty() && extends.isEmpty() && resourceUrl.isEmpty() && origin.isEmpty(); }
bool shouldFilter(AbstractResource* res) const;
void filterJustInCase(QVector<AbstractResource*>& input) const;
};
......
......@@ -322,6 +322,8 @@ AggregatedResultsStream * ResourcesModel::findResourceByPackageName(const QUrl&
AggregatedResultsStream* ResourcesModel::search(const AbstractResourcesBackend::Filters& search)
{
Q_ASSERT(!search.isEmpty());
auto streams = kTransform<QSet<ResultsStream*>>(m_backends, [search](AbstractResourcesBackend* backend){ return backend->search(search); });
return new AggregatedResultsStream(streams);
}
......
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