mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 05:26:32 +02:00
handles empty json object return
This commit is contained in:
parent
3e10d3b436
commit
e1b344e36d
1 changed files with 4 additions and 0 deletions
|
@ -151,6 +151,10 @@ QVariant GooglePolyScriptingInterface::parseJSON(QUrl url, int fileType) {
|
|||
QByteArray jsonString = getHTTPRequest(url);
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonString);
|
||||
QJsonObject obj = doc.object();
|
||||
if (obj.isEmpty()) {
|
||||
qCDebug(scriptengine) << "Assets with specified filters not found";
|
||||
return "";
|
||||
}
|
||||
if (obj.keys().first() == "error") {
|
||||
QString error = obj.value("error").toObject().value("message").toString();
|
||||
qCDebug(scriptengine) << error;
|
||||
|
|
Loading…
Reference in a new issue