From fc3fd75100fdf0d6a147492b911e1b937e73e1e6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 4 May 2018 10:42:19 -0700 Subject: [PATCH] Fix TextureMeta::deserialize not handling json parse errors --- libraries/ktx/src/TextureMeta.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/ktx/src/TextureMeta.cpp b/libraries/ktx/src/TextureMeta.cpp index 88235d8a4b..3a2abf24c4 100644 --- a/libraries/ktx/src/TextureMeta.cpp +++ b/libraries/ktx/src/TextureMeta.cpp @@ -11,6 +11,7 @@ #include "TextureMeta.h" +#include #include #include @@ -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; }