From 3f8a890dceb38427774abdcb0803d1f56f621c9d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 21 Oct 2018 09:53:37 +0200 Subject: tdf#120703 (PVS): redundant nullptr checks, redundant assign V668 There is no sense in testing the 'pMember' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. V519 The 'pObject' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 2876, 2877. Change-Id: I0c801c97e75da99bf39f7a14306e67abfb8a3d85 Reviewed-on: https://gerrit.libreoffice.org/62123 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/source/uibase/utlui/content.cxx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'sw/source/uibase/utlui/content.cxx') diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index a12b334dddc9..65e5d0395c40 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -740,10 +740,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) case ContentTypeId::POSTIT: { nMemberCount = 0; - if(!pMember) - pMember.reset( new SwContentArr ); - else - pMember->clear(); + pMember->clear(); SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr(); if (aMgr) { @@ -772,10 +769,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) case ContentTypeId::DRAWOBJECT: { nMemberCount = 0; - if(!pMember) - pMember.reset( new SwContentArr ); - else - pMember->clear(); + pMember->clear(); IDocumentDrawModelAccess& rIDDMA = pWrtShell->getIDocumentDrawModelAccess(); SwDrawModel* pModel = rIDDMA.GetDrawModel(); @@ -2865,9 +2859,7 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent) const size_t nCount = pPage->GetObjCount(); bool hasObjectMarked = false; - SdrObject* pObject = nullptr; - pObject = GetDrawingObjectsByContent( pCnt ); - if( pObject ) + if (SdrObject* pObject = GetDrawingObjectsByContent(pCnt)) { SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/); if( pPV ) -- cgit