From a0c26517028a25ccd39dc92f9da8539f25db85fc Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 12 Nov 2020 00:17:36 -0500 Subject: highlighting plugins from the data directory would crash the mod name is "data" and getByName() crashes with a mod name that doesn't exist --- src/modlist.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index 04abfb01..d7324e7f 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -860,9 +860,11 @@ void ModList::highlightMods(const QItemSelectionModel *selection, const MOShared if (fileEntry.get() != nullptr) { QString originName = QString::fromStdWString(directoryEntry.getOriginByID(fileEntry->getOrigin()).getName()); - - auto modInfo = ModInfo::getByName(originName); - modInfo->setPluginSelected(true); + const auto index = ModInfo::getIndex(originName); + if (index != UINT_MAX) { + auto modInfo = ModInfo::getByIndex(index); + modInfo->setPluginSelected(true); + } } } notifyChange(0, rowCount() - 1); -- cgit v1.3.1