diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-22 17:10:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-22 17:10:10 +0000 |
commit | 95ff4bb714d0814b40de723cd7fa7f120b88bbc8 (patch) | |
tree | b55107f5204abeecdd1903a0f1fef405688c914e /sd | |
parent | 079a90ef7e76bff3b692d2782b01f6120d385e43 (diff) |
coverity#1103725 Dereference before null check
Change-Id: Ie09af4913d3ac7681a7328c43595d01a98050a07
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index b7c9d83f3df6..8e806bd9d15f 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1392,14 +1392,17 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, sal_Bool bMaster, sal_Bool bCheckMasters) { + ::svl::IUndoManager* pUndoMgr = NULL; + if( mpDocSh ) + { mpDocSh->SetWaitCursor( true ); + pUndoMgr = mpDocSh->GetUndoManager(); + } - ::svl::IUndoManager* pUndoMgr = mpDocSh->GetUndoManager(); - - const bool bUndo = IsUndoEnabled(); + const bool bUndo = pUndoMgr && IsUndoEnabled(); - if( bUndo ) + if (bUndo) { pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString()); } @@ -1464,7 +1467,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, // we should never reach this, but one never knows... if( (pMaster == NULL) || (pNotesMaster == NULL) ) { - pUndoMgr->LeaveListAction(); + if (bUndo) + pUndoMgr->LeaveListAction(); if( mpDocSh ) mpDocSh->SetWaitCursor( false ); @@ -1568,7 +1572,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, StyleSheetUndoAction* pUndoChStyle = new StyleSheetUndoAction(this, pMySheet, &pHisSheet->GetItemSet()); - pUndoMgr->AddUndoAction(pUndoChStyle); + if (bUndo) + pUndoMgr->AddUndoAction(pUndoChStyle); pMySheet->GetItemSet().Put(pHisSheet->GetItemSet()); pMySheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); } @@ -1642,7 +1647,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, // Add UndoAction for creating and inserting the stylesheets to // the top of the UndoManager SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction( this, aCreatedStyles, true); - pUndoMgr->AddUndoAction(pMovStyles); + if (bUndo) + pUndoMgr->AddUndoAction(pMovStyles); } } |