diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-27 10:32:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-27 12:58:42 +0000 |
commit | f10c365f8812379fac104245a1c7ad638d493fb8 (patch) | |
tree | 4e920036b3453fd3ddf5b210e20829698a2c5703 /sc | |
parent | 3c095024dc9e6a72759d44038dbc4a67fb4f4bc9 (diff) |
coverity#1187663 Dereference after null check
Change-Id: Icd652f0d1e24a22bb4cc42f6ea6b9409f6807a1a
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/viewfun7.cxx | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 9c4fa208e2ca..474821158253 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -379,32 +379,31 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, MakeDrawLayer(); ScDrawView* pScDrawView = GetScDrawView(); + if (!pScDrawView) + return false; + // #i123922# check if the drop was over an existing object; if yes, evtl. replace // the graphic for a SdrGraphObj (including link state updates) or adapt the fill // style for other objects - if(pScDrawView) + SdrPageView* pPageView = pScDrawView->GetSdrPageView(); + if (pPageView) { - SdrPageView* pPageView = pScDrawView->GetSdrPageView(); - - if(pPageView) + SdrObject* pPickObj = 0; + if (pScDrawView->PickObj(rPos, pScDrawView->getHitTolLog(), pPickObj, pPageView)) { - SdrObject* pPickObj = 0; - if (pScDrawView->PickObj(rPos, pScDrawView->getHitTolLog(), pPickObj, pPageView)) + const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP)); + SdrObject* pResult = pScDrawView->ApplyGraphicToObject( + *pPickObj, + rGraphic, + aBeginUndo, + rFile, + rFilter); + + if (pResult) { - const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP)); - SdrObject* pResult = pScDrawView->ApplyGraphicToObject( - *pPickObj, - rGraphic, - aBeginUndo, - rFile, - rFilter); - - if (pResult) - { - // we are done; mark the modified/new object - pScDrawView->MarkObj(pResult, pScDrawView->GetSdrPageView()); - return true; - } + // we are done; mark the modified/new object + pScDrawView->MarkObj(pResult, pScDrawView->GetSdrPageView()); + return true; } } } |