sw/source/core/layout/fly.cxx |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 393565203e9027fe3ed0ff64cd46fdc1332ec480
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Dec 4 12:49:08 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Dec 4 21:09:32 2024 +0100

    sw: static_cast after dynamic_cast
    
    Change-Id: Ie50fd8bb2bbb26962ead459fe8014828c99fd755
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177789
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index cee12b59818b..8178a7e9e71d 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2530,19 +2530,21 @@ Size SwFlyFrame::ChgSize( const Size& aNewSize )
     // of the fly frame
     Size aAdjustedNewSize( aNewSize );
     {
-        if ( dynamic_cast<SwFlyAtContentFrame*>(this) &&
-             Lower() && dynamic_cast<SwNoTextFrame*>(Lower()) &&
-             static_cast<SwNoTextFrame*>(Lower())->GetNode()->GetOLENode() )
+        if (dynamic_cast<SwFlyAtContentFrame*>(this))
         {
-            SwRect aClipRect;
-            ::CalcClipRect( GetVirtDrawObj(), aClipRect, false );
-            if ( aAdjustedNewSize.Width() > aClipRect.Width() )
+            auto pLower = dynamic_cast<SwNoTextFrame*>(Lower());
+            if ( pLower && pLower->GetNode()->GetOLENode() )
             {
-                aAdjustedNewSize.setWidth( aClipRect.Width() );
-            }
-            if ( aAdjustedNewSize.Height() > aClipRect.Height() )
-            {
-                aAdjustedNewSize.setWidth( aClipRect.Height() );
+                SwRect aClipRect;
+                ::CalcClipRect( GetVirtDrawObj(), aClipRect, false );
+                if ( aAdjustedNewSize.Width() > aClipRect.Width() )
+                {
+                    aAdjustedNewSize.setWidth( aClipRect.Width() );
+                }
+                if ( aAdjustedNewSize.Height() > aClipRect.Height() )
+                {
+                    aAdjustedNewSize.setWidth( aClipRect.Height() );
+                }
             }
         }
     }

Reply via email to