sw/source/core/undo/docundo.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 942f50e7d379ba5137f4a64d39bd06d6decad9e8
Author: Michael Stahl <mst...@redhat.com>
Date:   Fri May 5 23:11:48 2017 +0200

    sw: fix invalid downcast in sw::UndoManager::Repeat()
    
    (regression from 64ea8306b0ceb001132ac9cbc945a12afc01b8cd)
    
    Change-Id: Ie5343b9911feea329fc176f0abe31edc9e68a33e

diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 96b01c18b20b..833044fb3f49 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -661,7 +661,15 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext,
 
     OUString const comment(pRepeatAction->GetComment());
     OUString const rcomment(pRepeatAction->GetRepeatComment(rContext));
-    SwUndoId const nId(static_cast<const SwUndo*>(pRepeatAction)->GetId());
+    auto const*const pListAction(dynamic_cast<SfxListUndoAction 
*>(pRepeatAction));
+    auto const*const pSwAction(dynamic_cast<SwUndo *>(pRepeatAction));
+    if (!pListAction && !pSwAction)
+    {
+        return false;
+    }
+    SwUndoId const nId((pSwAction)
+            ? pSwAction->GetId()
+            : static_cast<SwUndoId>(pListAction->GetId()));
     if (DoesUndo())
     {
         ViewShellId nViewShellId(-1);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to