fix: aborts when using a Qt build with assertions enabled
Preventing undefined behaviour hooray! :D Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -219,6 +219,10 @@ void ListModel::searchRequestFinished(QJsonDocument& doc)
 | 
			
		||||
        searchState = CanPossiblyFetchMore;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // When you have a Qt build with assertions turned on, proceeding here will abort the application
 | 
			
		||||
    if (newList.size() == 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1);
 | 
			
		||||
    modpacks.append(newList);
 | 
			
		||||
    endInsertRows();
 | 
			
		||||
 
 | 
			
		||||
@@ -221,6 +221,11 @@ void Flame::ListModel::searchRequestFinished()
 | 
			
		||||
        nextSearchOffset += 25;
 | 
			
		||||
        searchState = CanPossiblyFetchMore;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // When you have a Qt build with assertions turned on, proceeding here will abort the application
 | 
			
		||||
    if (newList.size() == 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1);
 | 
			
		||||
    modpacks.append(newList);
 | 
			
		||||
    endInsertRows();
 | 
			
		||||
 
 | 
			
		||||
@@ -290,6 +290,10 @@ void ModpackListModel::searchRequestFinished(QJsonDocument& doc_all)
 | 
			
		||||
        searchState = CanPossiblyFetchMore;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // When you have a Qt build with assertions turned on, proceeding here will abort the application
 | 
			
		||||
    if (newList.size() == 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1);
 | 
			
		||||
    modpacks.append(newList);
 | 
			
		||||
    endInsertRows();
 | 
			
		||||
 
 | 
			
		||||
@@ -217,6 +217,11 @@ void Technic::ListModel::searchRequestFinished()
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    searchState = Finished;
 | 
			
		||||
 | 
			
		||||
    // When you have a Qt build with assertions turned on, proceeding here will abort the application
 | 
			
		||||
    if (newList.size() == 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1);
 | 
			
		||||
    modpacks.append(newList);
 | 
			
		||||
    endInsertRows();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user