From 7916468e69e2c17e56d189efe8c74471764f85a3 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 8 Nov 2011 11:43:48 +0100 Subject: Get sure against "strange" behaviours in opensearchengine BUG: 285277 --- src/opensearch/opensearchengine.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') 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); -- cgit v1.2.1