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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 31 20:13:57 UTC 2021


 sw/source/core/docnode/node.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit aac3ef9df34b38d8fc786f13b0336c7cbe68ee51
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 31 12:07:56 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 31 22:13:15 2021 +0200

    fix crash in select-all
    
    <vmiklos> noelgrandin: hmm, when simply typing "a\nb\nc\d" into writer
    and trying to select-all, i get a crash from the new
    SwFrame::DynCastTextFrame(). is that something you see?
    https://pastebin.com/raw/v00ncxXP is the backtrace
    <vmiklos> sounds like the old code invoked dynamic_cast<> on nullptr
    fine, but the new pFoo->DynCastTextFrame() won't work if pFoo is nullptr
    <noelgrandin> vmiklos, doh!, thanks, will fix
    
    Change-Id: I58966512551e90ded3d3ecd65fef9f083dc6d852
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121365
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 67bf030fa8d8..d7a2a6ba7116 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1392,9 +1392,11 @@ void SwContentNode::MakeFramesForAdjacentContentNode(SwContentNode& rNode)
             if ( pViewShell && pViewShell->GetLayout() &&
                  pViewShell->GetLayout()->IsAnyShellAccessible() )
             {
+                auto pNext = pNew->FindNextCnt( true );
+                auto pPrev = pNew->FindPrevCnt();
                 pViewShell->InvalidateAccessibleParaFlowRelation(
-                            pNew->FindNextCnt( true )->DynCastTextFrame(),
-                            pNew->FindPrevCnt()->DynCastTextFrame() );
+                            pNext ? pNext->DynCastTextFrame() : nullptr,
+                            pPrev ? pPrev->DynCastTextFrame() : nullptr );
             }
         }
     }


More information about the Libreoffice-commits mailing list