summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-29 10:02:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-29 11:10:30 +0100
commit41df45af6ae710c0dc6077b2e232f36d561fe975 (patch)
treee5e2efec366e60d6e0399cb34a0abfd5423e14cc /svx
parent0c4baf56147ac9f39b190d2468ac3aafdf5aac41 (diff)
coverity#1325057 Dereference after null check
Change-Id: I561751aa08831d65dd1762ffcd80b4ae9ff04a7d
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdedxv.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index ad9c7f59fa87..ce29308d0e8b 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -517,13 +517,14 @@ void SdrObjEditView::ImpChainingEventHdl()
// Handling Undo
const int nText = 0; // XXX: hardcoded index (SdrTextObj::getText handles only 0)
- SdrUndoObjSetText *pTxtUndo = dynamic_cast< SdrUndoObjSetText* >
- ( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nText ) );
+ const bool bUndoEnabled = GetModel() && IsUndoEnabled();
+ SdrUndoObjSetText *pTxtUndo = bUndoEnabled ? dynamic_cast< SdrUndoObjSetText* >
+ ( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nText ) ) : nullptr;
// trigger actual chaining
pTextObj->onChainingEvent();
- if (pTxtUndo!=NULL)
+ if (pTxtUndo)
{
pTxtUndo->AfterSetText();
if (!pTxtUndo->IsDifferent())
@@ -846,7 +847,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
if( mxSelectionController.is() )
mxSelectionController->onSelectionHasChanged();
- if(IsUndoEnabled() && GetModel() && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
+ if (GetModel() && IsUndoEnabled() && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
{
SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit();
@@ -926,7 +927,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
SdrUndoManager* pUndoEditUndoManager = 0;
bool bNeedToUndoSavedRedoTextEdit(false);
- if(IsUndoEnabled() && GetModel() && pTEObj && pTEOutliner && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
+ if (GetModel() && IsUndoEnabled() && pTEObj && pTEOutliner && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
{
// change back the UndoManager to the remembered original one
::svl::IUndoManager* pOriginal = pTEOutliner->SetUndoManager(mpOldTextEditUndoManager);