[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [akonadi] src/widgets: Fix crash when configuration plugin is not found
From:       Daniel_Vrátil <null () kde ! org>
Date:       2018-08-17 13:32:19
Message-ID: E1fqerT-0007Fj-6s () code ! kde ! org
[Download RAW message or body]

Git commit d1ec19f71cbf1867667576fc4a46fd7ddcee1d92 by Daniel Vrátil.
Committed on 17/08/2018 at 13:32.
Pushed by dvratil into branch 'master'.

Fix crash when configuration plugin is not found

M  +14   -12   src/widgets/agentconfigurationdialog.cpp

https://commits.kde.org/akonadi/d1ec19f71cbf1867667576fc4a46fd7ddcee1d92

diff --git a/src/widgets/agentconfigurationdialog.cpp \
b/src/widgets/agentconfigurationdialog.cpp index 3a5453c28..045f81268 100644
--- a/src/widgets/agentconfigurationdialog.cpp
+++ b/src/widgets/agentconfigurationdialog.cpp
@@ -62,18 +62,20 @@ AgentConfigurationDialog::AgentConfigurationDialog(const \
                AgentInstance &instance
     connect(btnBox->button(QDialogButtonBox::Apply), &QPushButton::clicked,
             d->widget.data(), &AgentConfigurationWidget::save);
 
-    if (auto aboutData = d->widget->d->plugin->aboutData()) {
-        KHelpMenu *helpMenu = new KHelpMenu(this, *aboutData, true);
-        helpMenu->action(KHelpMenu::menuDonate);
-        //Initialize menu
-        QMenu *menu = helpMenu->menu();
-        // HACK: the actions are populated from QGuiApplication so they would refer \
                to the
-        // current application not to the agent, so we have to adjust the strings in \
                some
-        // of the actions.
-        helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(aboutData->programIconName()));
                
-        helpMenu->action(KHelpMenu::menuHelpContents)->setText(i18n("%1 Handbook", \
                aboutData->displayName()));
-        helpMenu->action(KHelpMenu::menuAboutApp)->setText(i18n("About %1", \
                aboutData->displayName()));
-        btnBox->addButton(QDialogButtonBox::Help)->setMenu(menu);
+    if (auto plugin = d->widget->d->plugin) {
+        if (auto aboutData = plugin->aboutData()) {
+            KHelpMenu *helpMenu = new KHelpMenu(this, *aboutData, true);
+            helpMenu->action(KHelpMenu::menuDonate);
+            //Initialize menu
+            QMenu *menu = helpMenu->menu();
+            // HACK: the actions are populated from QGuiApplication so they would \
refer to the +            // current application not to the agent, so we have to \
adjust the strings in some +            // of the actions.
+            helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(aboutData->programIconName()));
 +            helpMenu->action(KHelpMenu::menuHelpContents)->setText(i18n("%1 \
Handbook", aboutData->displayName())); +            \
helpMenu->action(KHelpMenu::menuAboutApp)->setText(i18n("About %1", \
aboutData->displayName())); +            \
btnBox->addButton(QDialogButtonBox::Help)->setMenu(menu); +        }
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic