From 4448418b63715bc64acbb19bd75bedf725cb4165 Mon Sep 17 00:00:00 2001 From: flow Date: Sun, 12 Jun 2022 09:44:03 -0300 Subject: [PATCH] fix: segfault when the same mod is present enabled and disabled at once This maintains the previous behaviour --- launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp index bde32b3e..80242fef 100644 --- a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp +++ b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp @@ -69,10 +69,12 @@ void ModFolderLoadTask::run() m_result->mods[mod.internal_id()] = mod; auto metadata = m_result->mods[chopped_id].metadata(); - mod.setMetadata(new Metadata::ModStruct(*metadata)); + if (metadata) { + mod.setMetadata(new Metadata::ModStruct(*metadata)); - m_result->mods[mod.internal_id()].setStatus(ModStatus::Installed); - m_result->mods.remove(chopped_id); + m_result->mods[mod.internal_id()].setStatus(ModStatus::Installed); + m_result->mods.remove(chopped_id); + } } else { m_result->mods[mod.internal_id()] = mod;