summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/undo/docundo.cxx10
1 files changed, 9 insertions, 1 deletions
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);