NOISSUE Handle JSON exceptions in ATLauncher support

Thanks to phit for pointing this out :)
This commit is contained in:
Jamie Mansfield 2021-04-05 21:19:05 +01:00
parent 3a1abb555b
commit d6dc22d57c
No known key found for this signature in database
GPG Key ID: 36F61598F39F67B0
4 changed files with 14 additions and 6 deletions

View File

@ -125,13 +125,12 @@ SET(MULTIMC_SOURCES
pages/modplatform/VanillaPage.cpp
pages/modplatform/VanillaPage.h
pages/modplatform/atlauncher/AtlModel.cpp
pages/modplatform/atlauncher/AtlModel.h
pages/modplatform/atlauncher/AtlFilterModel.cpp
pages/modplatform/atlauncher/AtlFilterModel.h
pages/modplatform/atlauncher/AtlListModel.cpp
pages/modplatform/atlauncher/AtlListModel.h
pages/modplatform/atlauncher/AtlPage.cpp
pages/modplatform/atlauncher/AtlPage.h
pages/modplatform/atlauncher/AtlPage.h
pages/modplatform/ftb/FtbFilterModel.cpp
pages/modplatform/ftb/FtbFilterModel.h

View File

@ -1,8 +1,9 @@
#include "AtlModel.h"
#include "AtlListModel.h"
#include <BuildConfig.h>
#include <MultiMC.h>
#include <Env.h>
#include <Json.h>
namespace Atl {
@ -99,7 +100,15 @@ void ListModel::requestFinished()
auto packObj = packRaw.toObject();
ATLauncher::IndexedPack pack;
try {
ATLauncher::loadIndexedPack(pack, packObj);
}
catch (const JSONValidationError &e) {
qDebug() << QString::fromUtf8(response);
qWarning() << "Error while reading pack manifest from ATLauncher: " << e.cause();
return;
}
// ignore packs without a published version
if(pack.versions.length() == 0) continue;

View File

@ -16,7 +16,7 @@
#pragma once
#include "AtlFilterModel.h"
#include "AtlModel.h"
#include "AtlListModel.h"
#include <QWidget>