diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-26 21:33:15 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-26 21:33:15 +0300 |
commit | c778dcbc9c326c1bf563852d7393bf43c1514346 (patch) | |
tree | b0b556492b5c83d07858f60d56feadca64983648 /launcher/ui/widgets/WideBar.cpp | |
parent | d7f4e40f85d1e253fe62e1c9e1cfb1842ffb0c86 (diff) | |
parent | a0944dab7a8fff9b5d9c2c8d35cc55349c93a3cd (diff) | |
download | PrismLauncher-c778dcbc9c326c1bf563852d7393bf43c1514346.tar.gz PrismLauncher-c778dcbc9c326c1bf563852d7393bf43c1514346.tar.bz2 PrismLauncher-c778dcbc9c326c1bf563852d7393bf43c1514346.zip |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curse
Diffstat (limited to 'launcher/ui/widgets/WideBar.cpp')
-rw-r--r-- | launcher/ui/widgets/WideBar.cpp | 13 |
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; } |