diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-12 12:46:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-12 13:03:59 +0000 |
commit | e79c381f4d4906d5ba6c02bb84b7a40475a5399b (patch) | |
tree | c21d4e441c5979b976c4893fb2d7d2a983607727 /sfx2 | |
parent | cc7b1ee2f3a06c6f0a52f6c6de06b2dd21e1150c (diff) |
coverity#441010 Dereference after null check
Change-Id: I3f35f2ed2154f75303d561efecd1638b73872b61
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 52 | ||||
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 41 |
3 files changed, 46 insertions, 53 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index c5f78a5671cc..06114c61be23 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -230,9 +230,9 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId, } } - SfxDispatcher *pDisp = pBindings->GetDispatcher_Impl(); - SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :0; - if ( !pChild && pMod ) + SfxDispatcher *pDisp = pBindings ? pBindings->GetDispatcher_Impl() : NULL; + SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) : NULL; + if (!pChild && pMod) { SfxChildWinFactArr_Impl *pFactories = pMod->GetChildWinFactories_Impl(); if ( pFactories ) diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 5af668194f45..3a0cf048db92 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -504,50 +504,8 @@ void SfxTemplatePanelControl::StateChanged( StateChangedType nStateChange ) DockingWindow::StateChanged( nStateChange ); } - -//========================================================================= -typedef std::vector<OUString> ExpandedEntries_t; - -/* [Description] - - TreeListBox class for displaying the hierarchical view of the templates -*/ - -class StyleTreeListBox_Impl : public DropListBox_Impl -{ -private: - SvTreeListEntry* pCurEntry; - Link aDoubleClickLink; - Link aDropLink; - OUString aParent; - OUString aStyle; - -protected: - virtual void Command( const CommandEvent& rMEvt ); - virtual bool Notify( NotifyEvent& rNEvt ); - virtual sal_Bool DoubleClickHdl(); - virtual bool ExpandingHdl(); - virtual void ExpandedHdl(); - virtual sal_Bool NotifyMoving(SvTreeListEntry* pTarget, - SvTreeListEntry* pEntry, - SvTreeListEntry*& rpNewParent, - sal_uIntPtr& rNewChildPos); -public: - StyleTreeListBox_Impl( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinStyle = 0); - - void SetDoubleClickHdl(const Link &rLink) { aDoubleClickLink = rLink; } - void SetDropHdl(const Link &rLink) { aDropLink = rLink; } - using SvTreeListBox::GetParent; - const OUString& GetParent() const { return aParent; } - const OUString& GetStyle() const { return aStyle; } - void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const; - - virtual PopupMenu* CreateContextMenu( void ); -}; - //------------------------------------------------------------------------- - void StyleTreeListBox_Impl::MakeExpanded_Impl(ExpandedEntries_t& rEntries) const { SvTreeListEntry *pEntry; @@ -1261,9 +1219,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox() } MakeTree_Impl(aArr); ExpandedEntries_t aEntries; - if(pTreeBox) - ((const StyleTreeListBox_Impl *)pTreeBox)-> - MakeExpanded_Impl( aEntries); + pTreeBox->MakeExpanded_Impl(aEntries); pTreeBox->SetUpdateMode( sal_False ); pTreeBox->Clear(); const sal_uInt16 nCount = aArr.size(); @@ -1850,11 +1806,9 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable) pTreeBox->SetNodeDefaultImages(); pTreeBox->SetSelectHdl( LINK(this, SfxCommonTemplateDialog_Impl, FmtSelectHdl)); - ((StyleTreeListBox_Impl*)pTreeBox)-> - SetDoubleClickHdl( + pTreeBox->SetDoubleClickHdl( LINK(this, SfxCommonTemplateDialog_Impl, ApplyHdl)); - ((StyleTreeListBox_Impl*)pTreeBox)-> - SetDropHdl(LINK(this, SfxCommonTemplateDialog_Impl, DropHdl)); + pTreeBox->SetDropHdl(LINK(this, SfxCommonTemplateDialog_Impl, DropHdl)); pTreeBox->SetOptimalImageIndent(); FillTreeBox(); SelectStyle(aSelectEntry); diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 68da5bcb09b7..8a4dfdc09a0d 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -81,6 +81,45 @@ public: virtual bool Notify( NotifyEvent& rNEvt ); }; +typedef std::vector<OUString> ExpandedEntries_t; + +/* [Description] + + TreeListBox class for displaying the hierarchical view of the templates +*/ + +class StyleTreeListBox_Impl : public DropListBox_Impl +{ +private: + SvTreeListEntry* pCurEntry; + Link aDoubleClickLink; + Link aDropLink; + OUString aParent; + OUString aStyle; + +protected: + virtual void Command( const CommandEvent& rMEvt ); + virtual bool Notify( NotifyEvent& rNEvt ); + virtual sal_Bool DoubleClickHdl(); + virtual bool ExpandingHdl(); + virtual void ExpandedHdl(); + virtual sal_Bool NotifyMoving(SvTreeListEntry* pTarget, + SvTreeListEntry* pEntry, + SvTreeListEntry*& rpNewParent, + sal_uIntPtr& rNewChildPos); +public: + StyleTreeListBox_Impl( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinStyle = 0); + + void SetDoubleClickHdl(const Link &rLink) { aDoubleClickLink = rLink; } + void SetDropHdl(const Link &rLink) { aDropLink = rLink; } + using SvTreeListBox::GetParent; + const OUString& GetParent() const { return aParent; } + const OUString& GetStyle() const { return aStyle; } + void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const; + + virtual PopupMenu* CreateContextMenu( void ); +}; + // class SfxActionListBox ------------------------------------------------ class SfxActionListBox : public DropListBox_Impl @@ -140,7 +179,7 @@ protected: SfxStyleFamilies* pStyleFamilies; SfxTemplateItem* pFamilyState[MAX_FAMILIES]; SfxStyleSheetBasePool* pStyleSheetPool; - SvTreeListBox* pTreeBox; + StyleTreeListBox_Impl* pTreeBox; SfxObjectShell* pCurObjShell; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager; |