Browse Source

bug-fix: remove unnecessary NULL check before delete

Le Tan 7 years ago
parent
commit
6d24f7e92b
2 changed files with 5 additions and 11 deletions
  1. 4 8
      src/dialog/vinsertimagedialog.cpp
  2. 1 3
      src/vtextedit.cpp

+ 4 - 8
src/dialog/vinsertimagedialog.cpp

@@ -54,10 +54,8 @@ VInsertImageDialog::VInsertImageDialog(const QString &p_title,
 
 VInsertImageDialog::~VInsertImageDialog()
 {
-    if (m_image) {
-        delete m_image;
-        m_image = NULL;
-    }
+    delete m_image;
+    m_image = NULL;
 }
 
 void VInsertImageDialog::setupUI(const QString &p_title,
@@ -152,10 +150,8 @@ void VInsertImageDialog::setImage(const QImage &image)
 {
     if (image.isNull()) {
         imagePreviewLabel->setVisible(false);
-        if (m_image) {
-            delete m_image;
-            m_image = NULL;
-        }
+        delete m_image;
+        m_image = NULL;
 
         handleInputChanged();
         return;

+ 1 - 3
src/vtextedit.cpp

@@ -36,9 +36,7 @@ VTextEdit::VTextEdit(const QString &p_text, QWidget *p_parent)
 
 VTextEdit::~VTextEdit()
 {
-    if (m_imageMgr) {
-        delete m_imageMgr;
-    }
+    delete m_imageMgr;
 }
 
 void VTextEdit::init()