From d42ae2995bfe4e631ec23f740fde118a10e9dbdc Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 15 Dec 2024 19:37:25 +0000 Subject: [PATCH] Fix crash on attempt to install mod not present in mod repository --- launcher/modManager/cmodlistview_moc.cpp | 2 +- launcher/modManager/modstatecontroller.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 27c671586..974c4062f 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -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)) diff --git a/launcher/modManager/modstatecontroller.cpp b/launcher/modManager/modstatecontroller.cpp index 718f9841a..77bd3fc03 100644 --- a/launcher/modManager/modstatecontroller.cpp +++ b/launcher/modManager/modstatecontroller.cpp @@ -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())