diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-07-08 20:51:27 +0100 |
---|---|---|
committer | TheKodeToad <TheKodeToad@proton.me> | 2023-07-08 20:55:30 +0100 |
commit | 08c140b9b45b1a8afd134793acedf867526d6432 (patch) | |
tree | e6e56fd6e6220428e68ae406ea443b99b4b605c6 /launcher/ui/widgets/WideBar.cpp | |
parent | 67d473aab773e7f94c394ebdde05581dc8f805de (diff) | |
download | PrismLauncher-08c140b9b45b1a8afd134793acedf867526d6432.tar.gz PrismLauncher-08c140b9b45b1a8afd134793acedf867526d6432.tar.bz2 PrismLauncher-08c140b9b45b1a8afd134793acedf867526d6432.zip |
Fix actionVisitItemPage insersion, and prevent widebar segfault
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
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; } |