1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +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); QJsonDocument json = QJsonDocument::fromJson(response);
const QVariant res = json.toVariant(); const QVariant res = json.toVariant();
if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) if (err.error != QJsonParseError::NoError || res.type() != QVariant::List)
return; return;
const QVariantList list = res.toMap().value(QSL("1")).toList(); const QVariantList list = res.toList();
if (list.isEmpty()) if (list.size() < 2)
return; return;
QStringList out; QStringList out;
foreach (const QVariant &v, list) foreach (const QVariant &v, list.at(1).toList())
out.append(v.toString()); out.append(v.toString());
emit suggestions(out); emit suggestions(out);