sw/source/core/undo/docundo.cxx |   55 ++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 29 deletions(-)

New commits:
commit 381a790066dba9d9e32196c36e31dd13402bbac4
Author: Michael Stahl <mst...@redhat.com>
Date:   Thu Sep 15 21:54:23 2016 +0200

    sw: remove some can-never-happen checks that are now assert()
    
    Change-Id: I16cd7253b3c8e65bf9f400ace2aa93e47c8981e4

diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 06a53f7..cc45eb8 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -320,37 +320,34 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter 
const*const pRewriter)
         SfxListUndoAction *const pListAction(
             dynamic_cast<SfxListUndoAction*>(pUndoAction));
         assert(pListAction);
-        if (pListAction)
+        if (UNDO_END != eUndoId)
         {
-            if (UNDO_END != eUndoId)
+            OSL_ENSURE(pListAction->GetId() == eUndoId,
+                    "EndUndo(): given ID different from StartUndo()");
+            // comment set by caller of EndUndo
+            OUString comment = SW_RES(UNDO_BASE + eUndoId);
+            if (pRewriter)
             {
-                OSL_ENSURE(pListAction->GetId() == eUndoId,
-                        "EndUndo(): given ID different from StartUndo()");
-                // comment set by caller of EndUndo
-                OUString comment = SW_RES(UNDO_BASE + eUndoId);
-                if (pRewriter)
-                {
-                    comment = pRewriter->Apply(comment);
-                }
-                pListAction->SetComment(comment);
-            }
-            else if ((UNDO_START != pListAction->GetId()))
-            {
-                // comment set by caller of StartUndo: nothing to do here
-            }
-            else if (pLastUndo)
-            {
-                // comment was not set at StartUndo or EndUndo:
-                // take comment of last contained action
-                // (note that this works recursively, i.e. the last contained
-                // action may be a list action created by StartUndo/EndUndo)
-                OUString const comment(pLastUndo->GetComment());
-                pListAction->SetComment(comment);
-            }
-            else
-            {
-                OSL_ENSURE(false, "EndUndo(): no comment?");
+                comment = pRewriter->Apply(comment);
             }
+            pListAction->SetComment(comment);
+        }
+        else if ((UNDO_START != pListAction->GetId()))
+        {
+            // comment set by caller of StartUndo: nothing to do here
+        }
+        else if (pLastUndo)
+        {
+            // comment was not set at StartUndo or EndUndo:
+            // take comment of last contained action
+            // (note that this works recursively, i.e. the last contained
+            // action may be a list action created by StartUndo/EndUndo)
+            OUString const comment(pLastUndo->GetComment());
+            pListAction->SetComment(comment);
+        }
+        else
+        {
+            OSL_ENSURE(false, "EndUndo(): no comment?");
         }
     }
 
@@ -646,7 +643,7 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext,
     }
     SfxUndoAction *const pRepeatAction(GetUndoAction());
     assert(pRepeatAction);
-    if (!pRepeatAction || !pRepeatAction->CanRepeat(rContext))
+    if (!pRepeatAction->CanRepeat(rContext))
     {
         return false;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to