diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-31 12:07:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-31 22:13:15 +0200 |
commit | aac3ef9df34b38d8fc786f13b0336c7cbe68ee51 (patch) | |
tree | 0a0142b325ed23a6a6181dc4836ec91862afad3e /sw | |
parent | c91a5c71d1696ab30632a2f093eb62ee783c4a65 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/docnode/node.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
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 ); } } } |