From 78cffd2979a6ed87e044fcb024cf4fdfc5c7cb3d Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Mon, 25 Apr 2022 12:52:05 +0200 Subject: Improve code quality --- src/selectionmode/actiontexthelper.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/selectionmode/actiontexthelper.cpp') diff --git a/src/selectionmode/actiontexthelper.cpp b/src/selectionmode/actiontexthelper.cpp index 3eb868a8c..103604236 100644 --- a/src/selectionmode/actiontexthelper.cpp +++ b/src/selectionmode/actiontexthelper.cpp @@ -22,10 +22,13 @@ void ActionTextHelper::registerTextWhenNothingIsSelected(QAction *action, QStrin void ActionTextHelper::textsWhenNothingIsSelectedEnabled(bool enabled) { for (auto i = m_registeredActionTextChanges.begin(); i != m_registeredActionTextChanges.end(); ++i) { - if (!i->action) { + while (!i->action) { i = m_registeredActionTextChanges.erase(i); - continue; + if (i == m_registeredActionTextChanges.end()) { + break; + } } + if (enabled && i->textStateOfRegisteredText == TextWhenNothingIsSelected) { QString textWhenSomethingIsSelected = i->action->text(); i->action->setText(i->registeredText); -- cgit v1.3