1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

OpenSearch: Fix loading search suggestions

This commit is contained in:
David Rosca 2015-12-18 11:30:39 +01:00
parent cbc83e81ba
commit 90abf57592

View File

@ -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);