summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-03-17 15:07:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-20 13:41:14 +0000
commite5d8be3271eeb806bde0f1d5ecdb53256284e555 (patch)
tree7ea9715abf3504ab8e0f5cd0e0e826732c2a2500 /sw
parent545ad8320643fa3d000f7eab3938d0576304630b (diff)
ubsan fix after "drop GetId() from SfxUndoAction"
bug introduced by commit 64ea8306b0ceb001132ac9cbc945a12afc01b8cd drop GetId() from SfxUndoAction Change-Id: I75b23650c7dc15fc76fe1b9118129ff8ead35315 Reviewed-on: https://gerrit.libreoffice.org/35333 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/undo/docundo.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index ee674659ddce..22b1e2a0a9bb 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -385,7 +385,12 @@ UndoManager::GetLastUndoInfo(
}
if (o_pId)
{
- *o_pId = static_cast<const SwUndo*>(pAction)->GetId();
+ if (auto pListAction = dynamic_cast<const SfxListUndoAction*>(pAction))
+ *o_pId = (SwUndoId)pListAction->GetId();
+ else if (auto pSwAction = dynamic_cast<const SwUndo*>(pAction))
+ *o_pId = pSwAction->GetId();
+ else
+ *o_pId = SwUndoId::EMPTY;
}
return true;
@@ -443,7 +448,12 @@ bool UndoManager::GetFirstRedoInfo(OUString *const o_pStr,
}
if (o_pId)
{
- *o_pId = static_cast<const SwUndo*>(pAction)->GetId();
+ if (auto pListAction = dynamic_cast<const SfxListUndoAction*>(pAction))
+ *o_pId = (SwUndoId)pListAction->GetId();
+ else if (auto pSwAction = dynamic_cast<const SwUndo*>(pAction))
+ *o_pId = pSwAction->GetId();
+ else
+ *o_pId = SwUndoId::EMPTY;
}
return true;