fix: segfault when the same mod is present enabled and disabled at once

This maintains the previous behaviour
This commit is contained in:
flow 2022-06-12 09:44:03 -03:00
parent 9f1f37e780
commit 4448418b63
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -69,11 +69,13 @@ void ModFolderLoadTask::run()
m_result->mods[mod.internal_id()] = mod;
auto metadata = m_result->mods[chopped_id].metadata();
if (metadata) {
mod.setMetadata(new Metadata::ModStruct(*metadata));
m_result->mods[mod.internal_id()].setStatus(ModStatus::Installed);
m_result->mods.remove(chopped_id);
}
}
else {
m_result->mods[mod.internal_id()] = mod;
m_result->mods[mod.internal_id()].setStatus(ModStatus::NoMetadata);