diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-11-08 11:43:48 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-11-08 11:43:48 +0100 |
commit | 7916468e69e2c17e56d189efe8c74471764f85a3 (patch) | |
tree | 8cac4c6b0cff0c0bd7d405a6d24e03e627d29227 | |
parent | rekonq 0.8.52 (diff) | |
download | rekonq-7916468e69e2c17e56d189efe8c74471764f85a3.tar.xz |
Get sure against "strange" behaviours in opensearchengine
BUG: 285277
-rw-r--r-- | src/opensearch/opensearchengine.cpp | 11 |
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); |