aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/widgets/WideBar.cpp
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-07-31 22:26:20 -0700
committerGitHub <noreply@github.com>2023-07-31 22:26:20 -0700
commit2d1197f59f824a3093ad71b9ee3466bd5e2825c8 (patch)
tree368a2ba5ab9a6ae9f3b3fd0841ea5ee1d0283add /launcher/ui/widgets/WideBar.cpp
parentb47993b736ba40a75b5b63290f9d7b5911f8150e (diff)
parent9137721e8e5b44f2338a36874a393435cbc6daa3 (diff)
downloadPrismLauncher-2d1197f59f824a3093ad71b9ee3466bd5e2825c8.tar.gz
PrismLauncher-2d1197f59f824a3093ad71b9ee3466bd5e2825c8.tar.bz2
PrismLauncher-2d1197f59f824a3093ad71b9ee3466bd5e2825c8.zip
Merge branch 'develop' into refactor/net-split-headers-to-proxy-class
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/widgets/WideBar.cpp')
-rw-r--r--launcher/ui/widgets/WideBar.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/launcher/ui/widgets/WideBar.cpp b/launcher/ui/widgets/WideBar.cpp
index ac34e3aa..a77c45fe 100644
--- a/launcher/ui/widgets/WideBar.cpp
+++ b/launcher/ui/widgets/WideBar.cpp
@@ -116,12 +116,21 @@ void WideBar::insertActionAfter(QAction* after, QAction* action)
if (iter == m_entries.end())
return;
+ iter++;
+ // the action to insert after is present
+ // however, the element after it isn't valid
+ if (iter == m_entries.end()) {
+ // append the action instead of inserting it
+ addAction(action);
+ return;
+ }
+
BarEntry entry;
- entry.bar_action = insertWidget((iter + 1)->bar_action, new ActionButton(action, this, m_use_default_action));
+ entry.bar_action = insertWidget(iter->bar_action, new ActionButton(action, this, m_use_default_action));
entry.menu_action = action;
entry.type = BarEntry::Type::Action;
- m_entries.insert(iter + 1, entry);
+ m_entries.insert(iter, entry);
m_menu_state = MenuState::Dirty;
}