From e3149900156ef4d207f64ec16fb2d367c3c29dba Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 29 Jan 2014 15:30:34 +0000 Subject: coverity#1132704 Dereference before null check Change-Id: I1922d7f3481fc56b33a078277cd17e54b14d6953 --- sd/source/ui/dlg/sdtreelb.cxx | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 56a856c07fe8..8d00e1bf6130 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -1143,34 +1143,20 @@ void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt ) { sal_Bool bMarked=sal_False; SvTreeListEntry* pNewEntry = GetCurEntry(); - if( GetParent(pNewEntry) == NULL ) + if (!pNewEntry) return; - OUString aStr=GetSelectEntry(); - Window* pWindow=NULL; - SdNavigatorWin* pSdNavigatorWin=NULL; - sd::DrawDocShell* pSdDrawDocShell = NULL; - if(pNewEntry) - pWindow=(Window*)GetParent(pNewEntry); - if(pWindow) - pSdNavigatorWin = (SdNavigatorWin*)pWindow; - if( pSdNavigatorWin ) - pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); - if(pSdDrawDocShell) + SvTreeListEntry* pParentEntry = GetParent(pNewEntry); + if (!pParentEntry) + return; + OUString aStr(GetSelectEntry()); + SdNavigatorWin* pSdNavigatorWin = (SdNavigatorWin*)pParentEntry; + sd::DrawDocShell* pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc); + if (pSdDrawDocShell) { pSdDrawDocShell->GotoTreeBookmark(aStr); bMarked=pSdDrawDocShell->GetObjectIsmarked(aStr); } - if(pNewEntry) - { - if(bMarked) - { - pNewEntry->SetMarked(sal_True); - } - else - { - pNewEntry->SetMarked( sal_False ); - } - } + pNewEntry->SetMarked(bMarked); Invalidate(); } } -- cgit