From 2526275c5e124996b7a6b0465bad8b2bc9a1dffe Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 30 Oct 2023 09:51:37 +0000 Subject: [PATCH] Better check Signed-off-by: TheKodeToad --- launcher/InstanceList.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/launcher/InstanceList.cpp b/launcher/InstanceList.cpp index 111f8d8a4..2b8f34293 100644 --- a/launcher/InstanceList.cpp +++ b/launcher/InstanceList.cpp @@ -290,7 +290,8 @@ void InstanceList::deleteGroup(const GroupId& name) qDebug() << "Remove" << instID << "from group" << name; removed = true; auto idx = getInstIndex(instance.get()); - emit dataChanged(index(idx), index(idx), { GroupRole }); + if (idx >= 0) + emit dataChanged(index(idx), index(idx), { GroupRole }); } } if (removed) @@ -314,7 +315,8 @@ void InstanceList::renameGroup(const QString& src, const QString& dst) qDebug() << "Set" << instID << "group to" << dst; modified = true; auto idx = getInstIndex(instance.get()); - emit dataChanged(index(idx), index(idx), { GroupRole }); + if (idx >= 0) + emit dataChanged(index(idx), index(idx), { GroupRole }); } } if (modified)