From b23f8e66c30281e3a85907ad0ec2cf80387bf90f Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Fri, 27 Jan 2012 14:58:19 +0100
Subject: [PATCH] Do not move nCurUndoAction < 0.

(Could easily happen when max undo steps is set to 1.)

Signed-off-by: Michael Meeks <michael.meeks@suse.com>
---
 svl/source/undo/undo.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index e3b8cd1..e61d695 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -658,7 +658,10 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT
         {
             i_guard.markForDeletion( m_pData->pActUndoArray->aUndoActions[0].pAction );
             m_pData->pActUndoArray->aUndoActions.Remove(0);
-            --m_pData->pActUndoArray->nCurUndoAction;
+            if (m_pData->pActUndoArray->nCurUndoAction > 0)
+            {
+                --m_pData->pActUndoArray->nCurUndoAction;
+            }
         }
     }
 
-- 
1.7.10.4

