Kaydet (Commit) 8f1a64bb authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#704702 Dereference after null check

Change-Id: I876ffc1511b2115562039b97961c28d7b30e2c06
Reviewed-on: https://gerrit.libreoffice.org/54730Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 47c830d2
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
using namespace com::sun::star; using namespace com::sun::star;
FuSelection::FuSelection(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pViewP, FuSelection::FuSelection(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP,
SdrModel* pDoc, const SfxRequest& rReq ) : SdrModel* pDoc, const SfxRequest& rReq)
FuDraw(pViewSh, pWin, pViewP, pDoc, rReq) : FuDraw(&rViewSh, pWin, pViewP, pDoc, rReq)
{ {
} }
...@@ -329,7 +329,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) ...@@ -329,7 +329,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
SetMouseButtonCode(rMEvt.GetButtons()); SetMouseButtonCode(rMEvt.GetButtons());
bool bReturn = FuDraw::MouseButtonUp(rMEvt); bool bReturn = FuDraw::MouseButtonUp(rMEvt);
bool bOle = pViewShell && pViewShell->GetViewFrame()->GetFrame().IsInPlace(); bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace();
SdrObject* pObj = nullptr; SdrObject* pObj = nullptr;
if (aDragTimer.IsActive() ) if (aDragTimer.IsActive() )
...@@ -341,8 +341,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) ...@@ -341,8 +341,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
bool bCopy = false; bool bCopy = false;
ScViewData* pViewData = ( pViewShell ? &pViewShell->GetViewData() : nullptr ); ScViewData& rViewData = pViewShell->GetViewData();
ScDocument* pDocument = ( pViewData ? pViewData->GetDocument() : nullptr ); ScDocument* pDocument = rViewData.GetDocument();
SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : nullptr ); SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : nullptr );
SdrPage* pPage = ( pPageView ? pPageView->GetPage() : nullptr ); SdrPage* pPage = ( pPageView ? pPageView->GetPage() : nullptr );
::std::vector< OUString > aExcludedChartNames; ::std::vector< OUString > aExcludedChartNames;
...@@ -428,7 +428,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) ...@@ -428,7 +428,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
} }
// maybe consider OLE object // maybe consider OLE object
SfxInPlaceClient* pIPClient = pViewShell ? pViewShell->GetIPClient() : nullptr; SfxInPlaceClient* pIPClient = pViewShell->GetIPClient();
if (pIPClient) if (pIPClient)
{ {
...@@ -454,7 +454,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) ...@@ -454,7 +454,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
SdrViewEvent aVEvt; SdrViewEvent aVEvt;
SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, 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(); sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
...@@ -513,13 +513,13 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) ...@@ -513,13 +513,13 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
pViewShell->GetViewData().GetDispatcher(). pViewShell->GetViewData().GetDispatcher().
Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD); 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 ); ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr );
if ( pModelObj ) if ( pModelObj )
{ {
SCTAB nTab = pViewData->GetTabNo(); SCTAB nTab = rViewData.GetTabNo();
ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab, ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab,
aProtectedChartRangesVector, aExcludedChartNames ); aProtectedChartRangesVector, aExcludedChartNames );
} }
......
...@@ -28,7 +28,7 @@ class SdrPageView; ...@@ -28,7 +28,7 @@ class SdrPageView;
class FuSelection : public FuDraw class FuSelection : public FuDraw
{ {
public: public:
FuSelection(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pView, FuSelection(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pView,
SdrModel* pDoc, const SfxRequest& rReq ); SdrModel* pDoc, const SfxRequest& rReq );
virtual ~FuSelection() override; virtual ~FuSelection() override;
......
...@@ -247,8 +247,8 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) ...@@ -247,8 +247,8 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
// so that immediately can be drawn // so that immediately can be drawn
} }
SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool()); SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool());
SetDrawFuncPtr(new FuSelection( aViewData.GetViewShell(), GetActiveWin(), pDrawView, SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView,
pLayer,aSfxRequest)); pLayer,aSfxRequest));
// used when switching back from page preview: restore saved design mode state // used when switching back from page preview: restore saved design mode state
// (otherwise, keep the default from the draw view ctor) // (otherwise, keep the default from the draw view ctor)
......
...@@ -217,7 +217,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) ...@@ -217,7 +217,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
case SID_OBJECT_SELECT: case SID_OBJECT_SELECT:
// not always switch back // not always switch back
if(pView->GetMarkedObjectList().GetMarkCount() == 0) SetDrawShell(bEx); 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; break;
case SID_DRAW_LINE: case SID_DRAW_LINE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment