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:
parent
88bf46f57b
commit
d42ae2995b
@ -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))
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user