From e79c381f4d4906d5ba6c02bb84b7a40475a5399b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 12 Feb 2014 12:46:37 +0000 Subject: coverity#441010 Dereference after null check Change-Id: I3f35f2ed2154f75303d561efecd1638b73872b61 --- sfx2/source/dialog/templdlg.cxx | 52 +++-------------------------------------- 1 file changed, 3 insertions(+), 49 deletions(-) (limited to 'sfx2/source/dialog/templdlg.cxx') 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 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); -- cgit v1.2.3