summaryrefslogtreecommitdiff
path: root/src/opensearch/opensearchengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opensearch/opensearchengine.cpp')
-rw-r--r--src/opensearch/opensearchengine.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/opensearch/opensearchengine.cpp b/src/opensearch/opensearchengine.cpp
index d5c64d68..28027828 100644
--- a/src/opensearch/opensearchengine.cpp
+++ b/src/opensearch/opensearchengine.cpp
@@ -254,11 +254,14 @@ bool OpenSearchEngine::operator<(const OpenSearchEngine &other) const
ResponseList OpenSearchEngine::parseSuggestion(const QString &searchTerm, const QByteArray &resp)
{
- QFile file(suggestionPathFor(searchTerm));
- if (file.open(QIODevice::WriteOnly | QIODevice::Text))
+ if (!searchTerm.isEmpty() && !resp.isEmpty())
{
- file.write(resp, resp.size());
- file.close();
+ QFile file(suggestionPathFor(searchTerm));
+ if (file.open(QIODevice::WriteOnly | QIODevice::Text))
+ {
+ file.write(resp, resp.size());
+ file.close();
+ }
}
return parseSuggestion(resp);