diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-05-05 23:11:48 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-05-05 23:32:46 +0200 |
commit | 942f50e7d379ba5137f4a64d39bd06d6decad9e8 (patch) | |
tree | e82459a7c94f984d46f93f42e6a01647c552daf5 /sw | |
parent | 7a47058e41a6fc2fdf23673fd583ebc8ca0b5541 (diff) |
sw: fix invalid downcast in sw::UndoManager::Repeat()
(regression from 64ea8306b0ceb001132ac9cbc945a12afc01b8cd)
Change-Id: Ie5343b9911feea329fc176f0abe31edc9e68a33e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 10 |
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); |