diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-01-21 15:45:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-01-21 17:05:43 +0000 |
commit | 975b29301727cbfa479a0fde628315ecb0cfb2f0 (patch) | |
tree | abe183edd78950c1e2605956b977eec63d2663b6 | |
parent | 7be62f8ceb864e9560a959006381d95bb8febfc6 (diff) |
coverity#1399025 Dereference after null check
Change-Id: I58ccfeb03388a60a6e2a506a22490ada5feb669f
-rw-r--r-- | sw/source/core/inc/frame.hxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 83c1cacdab1b..f2aa34c4edfe 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1059,24 +1059,23 @@ inline bool SwFrame::IsAccessibleFrame() const class SwFrameDeleteGuard { private: - SwFrame *m_pFrame; - bool m_bOldDeleteAllowed; + SwFrame *m_pForbidFrame; public: //Flag pFrame for SwFrameDeleteGuard lifetime that we shouldn't delete //it in e.g. SwSectionFrame::MergeNext etc because we will need it //again after the SwFrameDeleteGuard dtor explicit SwFrameDeleteGuard(SwFrame* pFrame) - : m_pFrame(pFrame) + : m_pForbidFrame((pFrame && !pFrame->IsDeleteForbidden()) ? + pFrame : nullptr) { - m_bOldDeleteAllowed = m_pFrame && !m_pFrame->IsDeleteForbidden(); - if (m_bOldDeleteAllowed) - m_pFrame->ForbidDelete(); + if (m_pForbidFrame) + m_pForbidFrame->ForbidDelete(); } ~SwFrameDeleteGuard() { - if (m_bOldDeleteAllowed) - m_pFrame->AllowDelete(); + if (m_pForbidFrame) + m_pForbidFrame->AllowDelete(); } }; |