fix crash with invalid mrpack format

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
(cherry picked from commit 1dd0728a58159bc835b2e7724a707776ae0b93ce)
This commit is contained in:
Trial97 2024-12-08 22:04:16 +02:00 committed by github-actions[bot]
parent 577999bd35
commit 344ae87f25

View File

@ -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 :)