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

New commits:
commit 571d13b03d0cd53a39ceaabd00cbff3e7fb6ade2
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jun 14 12:45:31 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jun 14 19:14:02 2024 +0200

    tdf#161346 sw: PDF export: fix crash on field in hidden text frame
    
    When creating a link rectangle for a SwGetRefField, the problem is that
    the cursor is positioned on 2 different nodes with 2 different text
    frames, neither of which is the node that contains the field; this
    happens because that node's text frame has a height of 0, so IsSelOvr()
    moves the cursor to a previous node.
    
    Check that SwCursorShell::GotoFormatField() did in fact go to the field.
    
    (regression from commit 9ba8d68c2b2fd06340bbdcb61dc3d57f6e3eb974)
    
    Change-Id: Ib74533f46dce8fb05224fddfff12e49577346b35
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168860
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit a9bc3ea1bef2a6b622a729dfa18eb3851ce7101e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168872
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index c758b970ddae..fd26d11823d8 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1031,6 +1031,11 @@ bool SwCursorShell::GotoFormatField( const 
SwFormatField& rField )
     bool bRet = !pCursor->IsSelOvr();
     if( bRet )
         
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
+    if (&pCursor->GetPoint()->GetNode() != pTNd)
+    {
+        // tdf#161346 failed to move to field
+        return false;
+    }
     return bRet;
 }
 

Reply via email to