diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-15 09:28:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-12-15 09:33:09 +0000 |
commit | 52a242e5bccc4307a1adcff093cfd4df7e6af101 (patch) | |
tree | 311b4fff34aa151d9e6836a7845b3d0bc0138f6d /sd | |
parent | d03d1ad55e0ef37d922aa88a7ed23ed4f7fdca02 (diff) |
coverity#704777 Explicit null dereferenced
Change-Id: Ia9a3a45183b7aa8367b3146061bde5036bcd8cfe
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdundo.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 28 |
2 files changed, 16 insertions, 14 deletions
diff --git a/sd/inc/sdundo.hxx b/sd/inc/sdundo.hxx index 75636404b0bc..60bb645d6007 100644 --- a/sd/inc/sdundo.hxx +++ b/sd/inc/sdundo.hxx @@ -33,7 +33,7 @@ public: : mpDoc(pSdDrawDocument) {} virtual ~SdUndoAction() {} - void SetComment(OUString& rStr) { maComment = rStr; } + void SetComment(const OUString& rStr) { maComment = rStr; } virtual OUString GetComment() const SAL_OVERRIDE { return maComment; } virtual SdUndoAction* Clone() const { return NULL; } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 615283460d41..c5da8097731d 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -492,20 +492,14 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) const Point aPagePos( GetActiveWindow()->GetViewOrigin() ); Size aPageSize = mpActualPage->GetSize(); Size aViewSize = GetActiveWindow()->GetViewSize(); - SdUndoGroup* pUndoGroup = NULL; - - if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE || - rReq.GetSlot() == SID_ATTR_LONG_ULSPACE ) - { - pUndoGroup = new SdUndoGroup(GetDoc()); - OUString aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER)); - pUndoGroup->SetComment(aString); - } switch ( rReq.GetSlot() ) { case SID_ATTR_LONG_LRSPACE: { + SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc()); + pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER)); + const SvxLongLRSpaceItem& rLRSpace = static_cast<const SvxLongLRSpaceItem&>( pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE))); @@ -559,10 +553,17 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) } InvalidateWindows(); } + + // give the undo group to the undo manager + GetViewFrame()->GetObjectShell()->GetUndoManager()-> + AddUndoAction(pUndoGroup); break; } case SID_ATTR_LONG_ULSPACE: { + SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc()); + pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER)); + const SvxLongULSpaceItem& rULSpace = static_cast<const SvxLongULSpaceItem&>( pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE))); @@ -617,6 +618,11 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) } InvalidateWindows(); } + + // give the undo group to the undo manager + GetViewFrame()->GetObjectShell()->GetUndoManager()-> + AddUndoAction(pUndoGroup); + break; } @@ -846,10 +852,6 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) break; } } - if ( pUndoGroup ) - // give the undo group to the undo manager - GetViewFrame()->GetObjectShell()->GetUndoManager()-> - AddUndoAction(pUndoGroup); } void DrawViewShell::GetRulerState(SfxItemSet& rSet) |