diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-05-27 22:12:38 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-06-29 19:00:55 +0200 |
commit | 66c0dacad3cf20a473c663ea5b0ef514d2d5baeb (patch) | |
tree | c548f968868b53f725954c6c31daac117eee8753 /sd | |
parent | 444a7fed913e91b02bb270e9cc96191710ce1614 (diff) |
sd: warning C6011: Dereferencing NULL pointer
Change-Id: Id073e5d340fc91836b4689fb3e7a558ef3263e56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168119
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit f60fd89e3d4ee60d9b9d0a02ed96c36ff8667188)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168066
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/table/TableDesignPane.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/view/viewoverlaymanager.cxx | 10 |
2 files changed, 15 insertions, 9 deletions
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 7c5154a0e1db..9930c8958fae 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -380,9 +380,13 @@ void TableDesignWidget::EditStyle(const OUString& rCommand) aBoxInfoItem.SetTable(false); aNewAttr.Put(aBoxInfoItem); + SdrView* pDrawView = mrBase.GetDrawView(); + if (!pDrawView) + return; + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxFormatCellsDialog( - mrBase.GetFrameWeld(), aNewAttr, mrBase.GetDrawView()->GetModel(), true) : nullptr); + mrBase.GetFrameWeld(), aNewAttr, pDrawView->GetModel(), true) : nullptr); if (pDlg && pDlg->Execute() == RET_OK) { endTextEditForStyle(xTableStyle); @@ -453,10 +457,9 @@ void TableDesignWidget::ApplyStyle() if( sStyleName.isEmpty() ) return; - SdrView* pView = mrBase.GetDrawView(); if( mxSelectedTable.is() ) { - if( pView ) + if (SdrView* pView = mrBase.GetDrawView()) { if (pView->IsTextEdit()) pView->SdrEndTextEdit(); @@ -694,8 +697,9 @@ void TableDesignWidget::endTextEditForStyle(const Reference<XInterface>& rStyle) if (xTableStyle != rStyle) return; - if (mrBase.GetDrawView()->IsTextEdit()) - mrBase.GetDrawView()->SdrEndTextEdit(); + SdrView* pDrawView = mrBase.GetDrawView(); + if (pDrawView && pDrawView->IsTextEdit()) + pDrawView->SdrEndTextEdit(); } void TableDesignWidget::addListener() diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index bd2e6be970f8..dfc6c61759fc 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -479,8 +479,9 @@ IMPL_LINK_NOARG(ViewOverlayManager, UpdateTagsHdl, void*, void) bool bChanges = DisposeTags(); bChanges |= CreateTags(); - if( bChanges && mrBase.GetDrawView() ) - static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles(); + SdrView* pDrawView = mrBase.GetDrawView(); + if( bChanges && pDrawView ) + static_cast< ::sd::View* >( pDrawView )->updateHandles(); } bool ViewOverlayManager::CreateTags() @@ -490,14 +491,15 @@ bool ViewOverlayManager::CreateTags() std::shared_ptr<ViewShell> aMainShell = mrBase.GetMainViewShell(); SdPage* pPage = aMainShell ? aMainShell->getCurrentPage() : nullptr; + SdrView* pDrawView = mrBase.GetDrawView(); - if( pPage && !pPage->IsMasterPage() && (pPage->GetPageKind() == PageKind::Standard) ) + if( pDrawView && pPage && !pPage->IsMasterPage() && (pPage->GetPageKind() == PageKind::Standard) ) { const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList(); for( SdrObject* pShape : rShapes ) { - if( pShape->IsEmptyPresObj() && (pShape->GetObjIdentifier() == SdrObjKind::OutlineText) && (mrBase.GetDrawView()->GetTextEditObject() != pShape) ) + if( pShape->IsEmptyPresObj() && (pShape->GetObjIdentifier() == SdrObjKind::OutlineText) && (pDrawView->GetTextEditObject() != pShape) ) { rtl::Reference< SmartTag > xTag( new ChangePlaceholderTag( *mrBase.GetMainViewShell()->GetView(), *pShape ) ); maTagVector.push_back(xTag); |