From 507de0fcbdbc3fa79f03453523cf83d13fa8907c Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Wed, 21 Jan 2026 18:20:34 +0500 Subject: [PATCH] fix: add missing returns after emitFailed/Aborted Signed-off-by: Octol1ttle --- launcher/ResourceDownloadTask.cpp | 2 +- launcher/minecraft/ComponentUpdateTask.cpp | 3 ++- launcher/minecraft/auth/AuthFlow.cpp | 2 +- launcher/minecraft/launch/AutoInstallJava.cpp | 2 +- launcher/minecraft/launch/ExtractNatives.cpp | 1 + launcher/minecraft/launch/ModMinecraftJar.cpp | 2 ++ launcher/minecraft/mod/tasks/LocalResourceUpdateTask.cpp | 1 + launcher/minecraft/update/AssetUpdateTask.cpp | 1 + launcher/modplatform/legacy_ftb/PackFetchTask.cpp | 4 ++-- launcher/modplatform/technic/SingleZipPackInstallTask.cpp | 2 +- launcher/modplatform/technic/SolderPackInstallTask.cpp | 6 +++--- launcher/tasks/SequentialTask.cpp | 2 +- 12 files changed, 17 insertions(+), 11 deletions(-) diff --git a/launcher/ResourceDownloadTask.cpp b/launcher/ResourceDownloadTask.cpp index 01c4cdc18..d50b3d5cf 100644 --- a/launcher/ResourceDownloadTask.cpp +++ b/launcher/ResourceDownloadTask.cpp @@ -103,8 +103,8 @@ void ResourceDownloadTask::downloadSucceeded() void ResourceDownloadTask::downloadFailed(QString reason) { - emitFailed(reason); m_filesNetJob.reset(); + emitFailed(reason); } void ResourceDownloadTask::downloadProgressChanged(qint64 current, qint64 total) diff --git a/launcher/minecraft/ComponentUpdateTask.cpp b/launcher/minecraft/ComponentUpdateTask.cpp index 56db20205..ee6feb63f 100644 --- a/launcher/minecraft/ComponentUpdateTask.cpp +++ b/launcher/minecraft/ComponentUpdateTask.cpp @@ -773,8 +773,9 @@ void ComponentUpdateTask::checkIfAllFinished() .arg(component->getName(), component->m_version)); } } + d->remoteLoadStatusList.clear(); + auto allErrors = allErrorsList.join("\n"); emitFailed(tr("Component metadata update task failed while downloading from remote server:\n%1").arg(allErrors)); - d->remoteLoadStatusList.clear(); } } diff --git a/launcher/minecraft/auth/AuthFlow.cpp b/launcher/minecraft/auth/AuthFlow.cpp index ccdc7c0bf..cea171b33 100644 --- a/launcher/minecraft/auth/AuthFlow.cpp +++ b/launcher/minecraft/auth/AuthFlow.cpp @@ -151,8 +151,8 @@ bool AuthFlow::changeState(AccountTaskState newState, QString reason) } bool AuthFlow::abort() { - emitAborted(); if (m_currentStep) m_currentStep->abort(); + emitAborted(); return true; } diff --git a/launcher/minecraft/launch/AutoInstallJava.cpp b/launcher/minecraft/launch/AutoInstallJava.cpp index 4f2d1f0c3..6a2bcb311 100644 --- a/launcher/minecraft/launch/AutoInstallJava.cpp +++ b/launcher/minecraft/launch/AutoInstallJava.cpp @@ -175,8 +175,8 @@ void AutoInstallJava::downloadJava(Meta::Version::Ptr version, QString javaName) m_current_task = makeShared(java->url, final_path, java->checksumType, java->checksumHash); break; case Java::DownloadType::Unknown: - emitFailed(tr("Could not determine Java download type!")); deletePath(); + emitFailed(tr("Could not determine Java download type!")); return; } #if defined(Q_OS_MACOS) diff --git a/launcher/minecraft/launch/ExtractNatives.cpp b/launcher/minecraft/launch/ExtractNatives.cpp index a7d47f1a1..f9c951135 100644 --- a/launcher/minecraft/launch/ExtractNatives.cpp +++ b/launcher/minecraft/launch/ExtractNatives.cpp @@ -75,6 +75,7 @@ void ExtractNatives::executeTask() const char* reason = QT_TR_NOOP("Couldn't extract native jar '%1' to destination '%2'"); emit logLine(QString(reason).arg(source, outputPath), MessageLevel::Fatal); emitFailed(tr(reason).arg(source, outputPath)); + return; } } emitSucceeded(); diff --git a/launcher/minecraft/launch/ModMinecraftJar.cpp b/launcher/minecraft/launch/ModMinecraftJar.cpp index e06080ba7..204f32fc3 100644 --- a/launcher/minecraft/launch/ModMinecraftJar.cpp +++ b/launcher/minecraft/launch/ModMinecraftJar.cpp @@ -51,11 +51,13 @@ void ModMinecraftJar::executeTask() // nuke obsolete stripped jar(s) if needed if (!FS::ensureFolderPathExists(m_inst->binRoot())) { emitFailed(tr("Couldn't create the bin folder for Minecraft.jar")); + return; } auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar"); if (!removeJar()) { emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath)); + return; } // create temporary modded jar, if needed diff --git a/launcher/minecraft/mod/tasks/LocalResourceUpdateTask.cpp b/launcher/minecraft/mod/tasks/LocalResourceUpdateTask.cpp index 02c73f858..8c2d6f0e1 100644 --- a/launcher/minecraft/mod/tasks/LocalResourceUpdateTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalResourceUpdateTask.cpp @@ -32,6 +32,7 @@ LocalResourceUpdateTask::LocalResourceUpdateTask(QDir index_dir, ModPlatform::In // Ensure a '.index' folder exists in the mods folder, and create it if it does not if (!FS::ensureFolderPathExists(index_dir.path())) { emitFailed(QString("Unable to create index directory at %1!").arg(index_dir.absolutePath())); + return; } #ifdef Q_OS_WIN32 diff --git a/launcher/minecraft/update/AssetUpdateTask.cpp b/launcher/minecraft/update/AssetUpdateTask.cpp index 74d545230..533f2ed56 100644 --- a/launcher/minecraft/update/AssetUpdateTask.cpp +++ b/launcher/minecraft/update/AssetUpdateTask.cpp @@ -68,6 +68,7 @@ void AssetUpdateTask::assetIndexFinished() auto entry = metacache->resolveEntry("asset_indexes", assets->id + ".json"); metacache->evictEntry(entry); emitFailed(tr("Failed to read the assets index!")); + return; } auto job = index.getDownloadJob(); diff --git a/launcher/modplatform/legacy_ftb/PackFetchTask.cpp b/launcher/modplatform/legacy_ftb/PackFetchTask.cpp index 43a5fbfa2..66a36723e 100644 --- a/launcher/modplatform/legacy_ftb/PackFetchTask.cpp +++ b/launcher/modplatform/legacy_ftb/PackFetchTask.cpp @@ -97,10 +97,10 @@ void PackFetchTask::fetchPrivate(const QStringList& toFetch) }); connect(job, &NetJob::aborted, this, [this, job, data] { - emit aborted(); job->deleteLater(); - data->clear(); + + emit aborted(); }); job->start(); diff --git a/launcher/modplatform/technic/SingleZipPackInstallTask.cpp b/launcher/modplatform/technic/SingleZipPackInstallTask.cpp index 09428c31d..c40213b48 100644 --- a/launcher/modplatform/technic/SingleZipPackInstallTask.cpp +++ b/launcher/modplatform/technic/SingleZipPackInstallTask.cpp @@ -78,8 +78,8 @@ void Technic::SingleZipPackInstallTask::downloadSucceeded() void Technic::SingleZipPackInstallTask::downloadFailed(QString reason) { m_abortable = false; - emitFailed(reason); m_filesNetJob.reset(); + emitFailed(reason); } void Technic::SingleZipPackInstallTask::downloadProgressChanged(qint64 current, qint64 total) diff --git a/launcher/modplatform/technic/SolderPackInstallTask.cpp b/launcher/modplatform/technic/SolderPackInstallTask.cpp index 9d8a1a340..a09116aca 100644 --- a/launcher/modplatform/technic/SolderPackInstallTask.cpp +++ b/launcher/modplatform/technic/SolderPackInstallTask.cpp @@ -98,8 +98,8 @@ void Technic::SolderPackInstallTask::fileListSucceeded() try { TechnicSolder::loadPackBuild(build, obj); } catch (const JSONValidationError& e) { - emitFailed(tr("Could not understand pack manifest:\n") + e.cause()); m_filesNetJob.reset(); + emitFailed(tr("Could not understand pack manifest:\n") + e.cause()); return; } @@ -159,8 +159,8 @@ void Technic::SolderPackInstallTask::downloadSucceeded() void Technic::SolderPackInstallTask::downloadFailed(QString reason) { m_abortable = false; - emitFailed(reason); m_filesNetJob.reset(); + emitFailed(reason); } void Technic::SolderPackInstallTask::downloadProgressChanged(qint64 current, qint64 total) @@ -171,8 +171,8 @@ void Technic::SolderPackInstallTask::downloadProgressChanged(qint64 current, qin void Technic::SolderPackInstallTask::downloadAborted() { - emitAborted(); m_filesNetJob.reset(); + emitAborted(); } void Technic::SolderPackInstallTask::extractFinished() diff --git a/launcher/tasks/SequentialTask.cpp b/launcher/tasks/SequentialTask.cpp index 2e48414f2..d1ffe61df 100644 --- a/launcher/tasks/SequentialTask.cpp +++ b/launcher/tasks/SequentialTask.cpp @@ -42,9 +42,9 @@ SequentialTask::SequentialTask(QString task_name) : ConcurrentTask(task_name, 1) void SequentialTask::subTaskFailed(Task::Ptr task, const QString& msg) { - emitFailed(msg); qWarning() << msg; ConcurrentTask::subTaskFailed(task, msg); + emitFailed(msg); } void SequentialTask::updateState()