[Libreoffice-commits] core.git: sw/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 20 13:41:36 UTC 2017


 sw/source/core/undo/docundo.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit e5d8be3271eeb806bde0f1d5ecdb53256284e555
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 17 15:07:56 2017 +0200

    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 at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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;


More information about the Libreoffice-commits mailing list