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 <ch.ehrlicher@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b487a7929d0f16c82a95e37d13de4651d92214cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Zou Ya 2021-03-03 10:57:32 +08:00 committed by Qt Cherry-pick Bot
parent 1b349a6df1
commit 9ff12dcfe1

View File

@ -1261,7 +1261,6 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo
newChild->last = nullptr;
// We are no longer interested in the old node
if (oldChild)
oldChild->ref.deref();
return oldChild;
@ -1295,7 +1294,6 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo
oldChild->prev = nullptr;
// We are no longer interested in the old node
if (oldChild)
oldChild->ref.deref();
return oldChild;