1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

Fix: Crash on startup when mod dependency is not found

This commit is contained in:
Dmitry Orlov
2022-03-21 01:33:04 +03:00
committed by Andrii Danylchenko
parent 4defbc314a
commit d98f240164
3 changed files with 28 additions and 16 deletions

View File

@ -997,10 +997,15 @@ namespace
bool testFilePresence(std::string scope, ResourceID resource)
{
std::set<std::string> allowedScopes;
if (scope != "core" && scope != "") // all real mods may have dependencies
if(scope != "core" && !scope.empty()) // all real mods may have dependencies
{
//NOTE: recursive dependencies are not allowed at the moment - update code if this changes
allowedScopes = VLC->modh->getModData(scope).dependencies;
bool found = true;
allowedScopes = VLC->modh->getModDependencies(scope, found);
if(!found)
return false;
allowedScopes.insert("core"); // all mods can use H3 files
}
allowedScopes.insert(scope); // mods can use their own files