sw/source/core/layout/fly.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit edaf6155496d452c67aa191c1d45a0328ef079e0
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Mar 3 07:51:33 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Mar 3 08:22:54 2023 +0000

    sw floattable: undefined behavior in SwFlyFrame::UpdateAttr_()
    
    The switch-case handled RES_FRM_SIZE and RES_FMT_CHG together, so when I
    added RES_FLY_SPLIT as a 3rd case for the same block, it started to
    handle RES_FLY_SPLIT as RES_FMT_CHG.
    
    For multi-page floating tables only the shared code is interesting, so
    just make the condition in the else branch more strict to avoid the
    unwanted downcast.
    
    Change-Id: I5015b06059f05fee400f427514d950d95a49df94
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148158
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 5cfe9b3d4950..4df2b690eb0c 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -888,7 +888,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, 
const SfxPoolItem *pNew,
             SwFormatChg *pOldFormatChg = nullptr;
             if (nWhich == RES_FRM_SIZE)
                 pNewFormatFrameSize = 
const_cast<SwFormatFrameSize*>(static_cast<const SwFormatFrameSize*>(pNew));
-            else
+            else if (nWhich == RES_FMT_CHG)
                 pOldFormatChg = const_cast<SwFormatChg*>(static_cast<const 
SwFormatChg*>(pOld));
 
             if (aURL.GetMap() && (pNewFormatFrameSize || pOldFormatChg))

Reply via email to