Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into netjob_retry
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
		| @@ -218,9 +218,24 @@ void HttpMetaCache::Load() | ||||
|     if (!index.open(QIODevice::ReadOnly)) | ||||
|         return; | ||||
|  | ||||
|     QJsonDocument json = QJsonDocument::fromJson(index.readAll()); | ||||
|     QJsonParseError parseError; | ||||
|     QJsonDocument json = QJsonDocument::fromJson(index.readAll(), &parseError); | ||||
|  | ||||
|     auto root = Json::requireObject(json, "HttpMetaCache root"); | ||||
|     // Fail if the JSON is invalid. | ||||
|     if (parseError.error != QJsonParseError::NoError) { | ||||
|         qCritical() << QString("Failed to parse HttpMetaCache file: %1 at offset %2") | ||||
|                            .arg(parseError.errorString(), QString::number(parseError.offset)) | ||||
|                            .toUtf8(); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     // Make sure the root is an object. | ||||
|     if (!json.isObject()) { | ||||
|         qCritical() << "HttpMetaCache root should be an object."; | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     auto root = json.object(); | ||||
|  | ||||
|     // check file version first | ||||
|     auto version_val = Json::ensureString(root, "version"); | ||||
|   | ||||
| @@ -36,9 +36,14 @@ | ||||
|  */ | ||||
|  | ||||
| #include "NetJob.h" | ||||
| #include "Application.h" | ||||
| #include "tasks/ConcurrentTask.h" | ||||
| #include "ui/dialogs/CustomMessageBox.h" | ||||
|  | ||||
| NetJob::NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network) | ||||
|     : ConcurrentTask(nullptr, job_name, APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt()), m_network(network) | ||||
| {} | ||||
|  | ||||
| auto NetJob::addNetAction(NetAction::Ptr action) -> bool | ||||
| { | ||||
|     action->setNetwork(m_network); | ||||
|   | ||||
| @@ -52,9 +52,7 @@ class NetJob : public ConcurrentTask { | ||||
|    public: | ||||
|     using Ptr = shared_qobject_ptr<NetJob>; | ||||
|  | ||||
|     explicit NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network) | ||||
|         : ConcurrentTask(nullptr, job_name), m_network(network) | ||||
|     {} | ||||
|     explicit NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> network); | ||||
|     ~NetJob() override = default; | ||||
|  | ||||
|     void startNext() override; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Trial97
					Trial97