From 9ff12dcfe1943202924a4d3889a61c3aebd2109b Mon Sep 17 00:00:00 2001 From: Zou Ya Date: Wed, 3 Mar 2021 10:57:32 +0800 Subject: [PATCH] The condition 'if(oldChild)' is redundant Either the condition 'if(oldChild)' is redundant or there is possible null pointer dereference: oldChild. Change-Id: I28971cfa33294679ddd325158669b422b3a1c2eb Reviewed-by: Christian Ehrlicher Reviewed-by: Edward Welbourne (cherry picked from commit b487a7929d0f16c82a95e37d13de4651d92214cc) Reviewed-by: Qt Cherry-pick Bot --- src/xml/dom/qdom.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index b7c676dd09f..658140f0626 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -1261,8 +1261,7 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo newChild->last = nullptr; // We are no longer interested in the old node - if (oldChild) - oldChild->ref.deref(); + oldChild->ref.deref(); return oldChild; } @@ -1295,8 +1294,7 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo oldChild->prev = nullptr; // We are no longer interested in the old node - if (oldChild) - oldChild->ref.deref(); + oldChild->ref.deref(); return oldChild; }