From 344ae87f257f2d3bc706d7ebad56e405b2330165 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 8 Dec 2024 22:04:16 +0200 Subject: [PATCH] fix crash with invalid mrpack format Signed-off-by: Trial97 (cherry picked from commit 1dd0728a58159bc835b2e7724a707776ae0b93ce) --- .../modplatform/modrinth/ModrinthInstanceCreationTask.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp index 994dd774f..3592d2ed7 100644 --- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp @@ -261,12 +261,14 @@ bool ModrinthCreationTask::createInstance() mod->setDetails(d); mods[file.hash.toHex()] = mod; } - + if (file.downloads.empty()) { + setError(tr("The file '%1' is missing a download link. This is invalid in the pack format.").arg(fileName)); + return false; + } qDebug() << "Will try to download" << file.downloads.front() << "to" << file_path; auto dl = Net::ApiDownload::makeFile(file.downloads.dequeue(), file_path); dl->addValidator(new Net::ChecksumValidator(file.hashAlgorithm, file.hash)); downloadMods->addNetAction(dl); - if (!file.downloads.empty()) { // FIXME: This really needs to be put into a ConcurrentTask of // MultipleOptionsTask's , once those exist :)