1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Fix crash on attempt to install mod not present in mod repository

This commit is contained in:
Ivan Savenko 2024-12-15 19:37:25 +00:00
parent 88bf46f57b
commit d42ae2995b
2 changed files with 4 additions and 1 deletions

View File

@ -860,7 +860,7 @@ void CModListView::installMods(QStringList archives)
// uninstall old version of mod, if installed
for(QString mod : modNames)
{
if(modStateModel->getMod(mod).isInstalled())
if(modStateModel->isModExists(mod) && modStateModel->getMod(mod).isInstalled())
{
logGlobal->info("Uninstalling old version of mod '%s'", mod.toStdString());
if (modStateModel->isModEnabled(mod))

View File

@ -120,6 +120,9 @@ bool ModStateController::disableMod(QString modname)
bool ModStateController::canInstallMod(QString modname)
{
if (!modList->isModExists(modname))
return true; // for installation of unknown mods, e.g. via "Install from file" option
auto mod = modList->getMod(modname);
if(mod.isSubmod())