sc/source/ui/drawfunc/fusel.cxx | 22 +++++++++++----------- sc/source/ui/inc/fusel.hxx | 2 +- sc/source/ui/view/tabview5.cxx | 4 ++-- sc/source/ui/view/tabvwsh2.cxx | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-)
New commits: commit 8f1a64bb0627dc82fce127a723d2e391bf9ddf0d Author: Caolán McNamara <[email protected]> Date: Wed May 23 21:08:45 2018 +0100 coverity#704702 Dereference after null check Change-Id: I876ffc1511b2115562039b97961c28d7b30e2c06 Reviewed-on: https://gerrit.libreoffice.org/54730 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 3ca765679ddc..f5a710a20800 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -56,9 +56,9 @@ using namespace com::sun::star; -FuSelection::FuSelection(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pViewP, - SdrModel* pDoc, const SfxRequest& rReq ) : - FuDraw(pViewSh, pWin, pViewP, pDoc, rReq) +FuSelection::FuSelection(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP, + SdrModel* pDoc, const SfxRequest& rReq) + : FuDraw(&rViewSh, pWin, pViewP, pDoc, rReq) { } @@ -329,7 +329,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) SetMouseButtonCode(rMEvt.GetButtons()); bool bReturn = FuDraw::MouseButtonUp(rMEvt); - bool bOle = pViewShell && pViewShell->GetViewFrame()->GetFrame().IsInPlace(); + bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace(); SdrObject* pObj = nullptr; if (aDragTimer.IsActive() ) @@ -341,8 +341,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); bool bCopy = false; - ScViewData* pViewData = ( pViewShell ? &pViewShell->GetViewData() : nullptr ); - ScDocument* pDocument = ( pViewData ? pViewData->GetDocument() : nullptr ); + ScViewData& rViewData = pViewShell->GetViewData(); + ScDocument* pDocument = rViewData.GetDocument(); SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : nullptr ); SdrPage* pPage = ( pPageView ? pPageView->GetPage() : nullptr ); ::std::vector< OUString > aExcludedChartNames; @@ -428,7 +428,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) } // maybe consider OLE object - SfxInPlaceClient* pIPClient = pViewShell ? pViewShell->GetIPClient() : nullptr; + SfxInPlaceClient* pIPClient = pViewShell->GetIPClient(); if (pIPClient) { @@ -454,7 +454,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) SdrViewEvent aVEvt; SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ); - if (eHit != SdrHitKind::NONE && aVEvt.pObj == pObj && pViewShell) + if (eHit != SdrHitKind::NONE && aVEvt.pObj == pObj) { sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); @@ -513,13 +513,13 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) pViewShell->GetViewData().GetDispatcher(). Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD); - if ( bCopy && pViewData && pDocument && pPage ) + if ( bCopy && pDocument && pPage ) { - ScDocShell* pDocShell = pViewData->GetDocShell(); + ScDocShell* pDocShell = rViewData.GetDocShell(); ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr ); if ( pModelObj ) { - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab, aProtectedChartRangesVector, aExcludedChartNames ); } diff --git a/sc/source/ui/inc/fusel.hxx b/sc/source/ui/inc/fusel.hxx index 986e98565268..70648c7076f8 100644 --- a/sc/source/ui/inc/fusel.hxx +++ b/sc/source/ui/inc/fusel.hxx @@ -28,7 +28,7 @@ class SdrPageView; class FuSelection : public FuDraw { public: - FuSelection(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pView, + FuSelection(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pView, SdrModel* pDoc, const SfxRequest& rReq ); virtual ~FuSelection() override; diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index e78b45ced30a..8f95f23078db 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -247,8 +247,8 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) // so that immediately can be drawn } SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool()); - SetDrawFuncPtr(new FuSelection( aViewData.GetViewShell(), GetActiveWin(), pDrawView, - pLayer,aSfxRequest)); + SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView, + pLayer,aSfxRequest)); // used when switching back from page preview: restore saved design mode state // (otherwise, keep the default from the draw view ctor) diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index ff5b81a37c00..638358a56909 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -217,7 +217,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) case SID_OBJECT_SELECT: // not always switch back if(pView->GetMarkedObjectList().GetMarkCount() == 0) SetDrawShell(bEx); - pTabView->SetDrawFuncPtr(new FuSelection(this, pWin, pView, pDoc, aNewReq)); + pTabView->SetDrawFuncPtr(new FuSelection(*this, pWin, pView, pDoc, aNewReq)); break; case SID_DRAW_LINE: _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
