aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-06-24 20:09:44 -0300
committerflow <flowlnlnln@gmail.com>2022-07-03 12:44:19 -0300
commite5f6dc1b14a03b078b69be1c4c3c5819092604c3 (patch)
tree1ac686ae1ab8998fb5b55dfe03d5d4528923892c /launcher/minecraft/mod
parent145da82cd8ca6856975eca175fdad74f6d6a0659 (diff)
downloadPrismLauncher-e5f6dc1b14a03b078b69be1c4c3c5819092604c3.tar.gz
PrismLauncher-e5f6dc1b14a03b078b69be1c4c3c5819092604c3.tar.bz2
PrismLauncher-e5f6dc1b14a03b078b69be1c4c3c5819092604c3.zip
fix: aborts when using a Qt build with assertions enabled
Preventing undefined behaviour hooray! :D Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp
index ded2d3a2..bc2362a9 100644
--- a/launcher/minecraft/mod/ModFolderModel.cpp
+++ b/launcher/minecraft/mod/ModFolderModel.cpp
@@ -167,12 +167,16 @@ void ModFolderModel::finishUpdate()
{
QSet<QString> added = newSet;
added.subtract(currentSet);
- beginInsertRows(QModelIndex(), mods.size(), mods.size() + added.size() - 1);
- for(auto & addedMod: added) {
- mods.append(newMods[addedMod]);
- resolveMod(mods.last());
+
+ // When you have a Qt build with assertions turned on, proceeding here will abort the application
+ if (added.size() > 0) {
+ beginInsertRows(QModelIndex(), mods.size(), mods.size() + added.size() - 1);
+ for (auto& addedMod : added) {
+ mods.append(newMods[addedMod]);
+ resolveMod(mods.last());
+ }
+ endInsertRows();
}
- endInsertRows();
}
// update index