NOISSUE fix a bunch of valgrind errors

This commit is contained in:
Petr Mrázek 2020-06-28 13:25:53 +02:00
parent a0ef20a264
commit cd57e354fe
3 changed files with 8 additions and 4 deletions

View File

@ -53,7 +53,9 @@ public: /* methods */
auto fname = m_entity->localFilename(); auto fname = m_entity->localFilename();
try try
{ {
m_entity->parse(Json::requireObject(Json::requireDocument(data, fname), fname)); auto doc = Json::requireDocument(data, fname);
auto obj = Json::requireObject(doc, fname);
m_entity->parse(obj);
return true; return true;
} }
catch (const Exception &e) catch (const Exception &e)
@ -87,7 +89,9 @@ bool Meta::BaseEntity::loadLocalFile()
// TODO: check if the file has the expected checksum // TODO: check if the file has the expected checksum
try try
{ {
parse(Json::requireObject(Json::requireDocument(fname, fname), fname)); auto doc = Json::requireDocument(fname, fname);
auto obj = Json::requireObject(doc, fname);
parse(obj);
return true; return true;
} }
catch (const Exception &e) catch (const Exception &e)

View File

@ -9,7 +9,6 @@
class MinecraftInstance; class MinecraftInstance;
using ComponentContainer = QList<ComponentPtr>; using ComponentContainer = QList<ComponentPtr>;
using ComponentIndex = QMap<QString, ComponentPtr>; using ComponentIndex = QMap<QString, ComponentPtr>;
using ConnectionList = QList<QMetaObject::Connection>;
struct PackProfileData struct PackProfileData
{ {

View File

@ -184,7 +184,8 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
int index = 1; int index = 1;
try try
{ {
auto doc = Json::requireObject(Json::requireDocument(data)); auto toplevel_doc = Json::requireDocument(data);
auto doc = Json::requireObject(toplevel_doc);
auto file_type = Json::requireString(doc, "file_type"); auto file_type = Json::requireString(doc, "file_type");
if(file_type != "MMC-TRANSLATION-INDEX") if(file_type != "MMC-TRANSLATION-INDEX")
{ {