[pim/trojita] src/Plugins: Remove redundant nullptr checks

Espen Sandøy Hustad <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit a731daa2cb0bc8ed6896974da1d46c0a295cc63c by Espen Sandøy Hustad.
Committed on 03/08/2026 at 18:42.
Pushed by ehustad into branch 'master'.

Remove redundant nullptr checks

It's perfectly safe to call delete on nullptrs.

M  +3    -9    src/Plugins/PluginManager.cpp

https://invent.kde.org/pim/trojita/-/commit/a731daa2cb0bc8ed6896974da1d46c0a295cc63c

diff --git a/src/Plugins/PluginManager.cpp b/src/Plugins/PluginManager.cpp
index 6e0721573..38d2f9376 100644
--- a/src/Plugins/PluginManager.cpp
+++ b/src/Plugins/PluginManager.cpp
@@ -220,9 +220,7 @@ void PluginManager::setAddressbookPlugin(const QString &name)
     m_addressbookName = name;
     m_settings->setValue(m_addressbookKey, name);
 
-    if (m_addressbook) {
-        delete m_addressbook;
-    }
+    delete m_addressbook;
 
     auto plugin = m_availableAddressbookPlugins.find(name);
     if (plugin != m_availableAddressbookPlugins.end()) {
@@ -240,9 +238,7 @@ void PluginManager::setPasswordPlugin(const QString &name)
     m_passwordName = name;
     m_settings->setValue(m_passwordKey, name);
 
-    if (m_password) {
-        delete m_password;
-    }
+    delete m_password;
 
     auto plugin = m_availablePasswordPlugins.find(name);
     if (plugin != m_availablePasswordPlugins.end()) {
@@ -260,9 +256,7 @@ void PluginManager::setSpellcheckerPlugin(const QString &name)
     m_spellcheckerName = name;
     m_settings->setValue(m_spellcheckerKey, name);
 
-    if (m_spellchecker) {
-        delete m_spellchecker;
-    }
+    delete m_spellchecker;
 
     auto plugin = m_availableSpellcheckPlugins.find(name);
     if (plugin != m_availableSpellcheckPlugins.end()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.