Merge pull request #1742 from TayouVR/fix-resourcepack-crash

fix switch/case fallthrough in resource parse tasks
This commit is contained in:
Tayou 2023-10-28 12:44:40 +02:00 committed by GitHub
commit df2a92d5f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -688,6 +688,7 @@ bool loadIconFile(const Mod& mod)
return png_invalid(); // icon invalid return png_invalid(); // icon invalid
} }
} }
return false;
} }
case ResourceType::ZIPFILE: { case ResourceType::ZIPFILE: {
QuaZip zip(mod.fileinfo().filePath()); QuaZip zip(mod.fileinfo().filePath());
@ -714,6 +715,7 @@ bool loadIconFile(const Mod& mod)
} else { } else {
return png_invalid(); // could not set icon as current file. return png_invalid(); // could not set icon as current file.
} }
return false;
} }
case ResourceType::LITEMOD: { case ResourceType::LITEMOD: {
return false; // can lightmods even have icons? return false; // can lightmods even have icons?

View File

@ -232,10 +232,9 @@ bool processPackPNG(const ResourcePack& pack)
} else { } else {
return png_invalid(); // pack.png does not exists or is not a valid file. return png_invalid(); // pack.png does not exists or is not a valid file.
} }
return false; // not processed correctly; https://github.com/PrismLauncher/PrismLauncher/issues/1740
} }
case ResourceType::ZIPFILE: { case ResourceType::ZIPFILE: {
Q_ASSERT(pack.type() == ResourceType::ZIPFILE);
QuaZip zip(pack.fileinfo().filePath()); QuaZip zip(pack.fileinfo().filePath());
if (!zip.open(QuaZip::mdUnzip)) if (!zip.open(QuaZip::mdUnzip))
return false; // can't open zip file return false; // can't open zip file
@ -259,6 +258,7 @@ bool processPackPNG(const ResourcePack& pack)
} else { } else {
return png_invalid(); // could not set pack.mcmeta as current file. return png_invalid(); // could not set pack.mcmeta as current file.
} }
return false; // not processed correctly; https://github.com/PrismLauncher/PrismLauncher/issues/1740
} }
default: default:
qWarning() << "Invalid type for resource pack parse task!"; qWarning() << "Invalid type for resource pack parse task!";

View File

@ -186,10 +186,9 @@ bool processPackPNG(const TexturePack& pack)
} else { } else {
return png_invalid(); // pack.png does not exists or is not a valid file. return png_invalid(); // pack.png does not exists or is not a valid file.
} }
return false;
} }
case ResourceType::ZIPFILE: { case ResourceType::ZIPFILE: {
Q_ASSERT(pack.type() == ResourceType::ZIPFILE);
QuaZip zip(pack.fileinfo().filePath()); QuaZip zip(pack.fileinfo().filePath());
if (!zip.open(QuaZip::mdUnzip)) if (!zip.open(QuaZip::mdUnzip))
return false; // can't open zip file return false; // can't open zip file
@ -215,6 +214,7 @@ bool processPackPNG(const TexturePack& pack)
zip.close(); zip.close();
return png_invalid(); // could not set pack.mcmeta as current file. return png_invalid(); // could not set pack.mcmeta as current file.
} }
return false;
} }
default: default:
qWarning() << "Invalid type for resource pack parse task!"; qWarning() << "Invalid type for resource pack parse task!";