From 90abf57592a406e2c7c17d69f6e5b698d0c99b57 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Fri, 18 Dec 2015 11:30:39 +0100 Subject: [PATCH] OpenSearch: Fix loading search suggestions --- src/lib/opensearch/opensearchengine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/opensearch/opensearchengine.cpp b/src/lib/opensearch/opensearchengine.cpp index 68bf0d20e..85b187dce 100644 --- a/src/lib/opensearch/opensearchengine.cpp +++ b/src/lib/opensearch/opensearchengine.cpp @@ -627,17 +627,17 @@ void OpenSearchEngine::suggestionsObtained() QJsonDocument json = QJsonDocument::fromJson(response); const QVariant res = json.toVariant(); - if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) + if (err.error != QJsonParseError::NoError || res.type() != QVariant::List) return; - const QVariantList list = res.toMap().value(QSL("1")).toList(); + const QVariantList list = res.toList(); - if (list.isEmpty()) + if (list.size() < 2) return; QStringList out; - foreach (const QVariant &v, list) + foreach (const QVariant &v, list.at(1).toList()) out.append(v.toString()); emit suggestions(out);