sw/source/core/layout/flowfrm.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 6f87ce01478a59532f0623805fbaccce7de4637f
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Mar 7 08:42:42 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Mar 7 10:24:29 2023 +0000

    sw: fix crash in GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid()
    
    Crashreport signature:
    
    program/libswlo.so
          SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() 
const
                  sw/source/core/layout/flowfrm.cxx:1741
    program/libswlo.so
          objectpositioning::SwAnchoredObjectPosition::GetTopForObjPos(SwFrame 
const&, SwRectFnCollection* const&, bool) const
                  include/svl/itemset.hxx:101
    program/libswlo.so
          objectpositioning::SwToContentAnchoredObjectPosition::CalcPosition()
                  
sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx:1020
    program/libswlo.so
          SwAnchoredDrawObject::MakeObjPosAnchoredAtPara()
                  sw/source/core/layout/anchoreddrawobject.cxx:424
    
    Change-Id: If162602f6a1cc2108c0de385652e93e23be920be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148375
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index c53512b2763a..3dde726ec60f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1738,6 +1738,11 @@ SwTwips 
SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() cons
 {
     SwTwips nUpperSpaceAmountConsideredForPrevFrameAndPageGrid = 0;
 
+    if (!m_rThis.GetUpper() || !m_rThis.GetUpper()->GetFormat())
+    {
+        return nUpperSpaceAmountConsideredForPrevFrameAndPageGrid;
+    }
+
     if ( 
!m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS)
 )
     {
         nUpperSpaceAmountConsideredForPrevFrameAndPageGrid =

Reply via email to