mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Fix TextureMeta::deserialize not handling json parse errors
This commit is contained in:
parent
ac0fe62086
commit
fc3fd75100
1 changed files with 6 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "TextureMeta.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
|
@ -19,7 +20,12 @@ const QString TEXTURE_META_EXTENSION = ".texmeta.json";
|
|||
bool TextureMeta::deserialize(const QByteArray& data, TextureMeta* meta) {
|
||||
QJsonParseError error;
|
||||
auto doc = QJsonDocument::fromJson(data, &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qDebug() << "Failed to parse TextureMeta:" << error.errorString();
|
||||
return false;
|
||||
}
|
||||
if (!doc.isObject()) {
|
||||
qDebug() << "Unable to process TextureMeta: top-level value is not an Object";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue