oox/source/export/shapes.cxx |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 0318671fb187941726316442651911a96a80f2f4
Author:     Karthik Godha <[email protected]>
AuthorDate: Tue Oct 21 09:41:13 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Oct 22 19:43:25 2025 +0200

    tdf#168786: Fix PPT->PPTX internal link leading nowhere
    
    When saving PPT files with invalid link targets to PPTX, it results in
    corrupted XML output.
    
    Remove links with empty targets during PPTX export.
    
    Change-Id: I4c0a413c5a9c479094b3f48eead6d3676e6cf804
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192762
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 715d0989db71..76a5ed28f280 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1004,16 +1004,20 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
             bool bExtURL = URLTransformer().isExternalURL(sBookmark);
             sBookmark = bExtURL ? sBookmark : 
lcl_GetTarget(GetFB()->getModel(), sBookmark);
 
-            OUString sRelId
-                = mpFB->addRelation(mpFS->getOutputStream(),
-                                    bExtURL ? 
oox::getRelationship(Relationship::HYPERLINK)
-                                            : 
oox::getRelationship(Relationship::SLIDE),
-                                    sBookmark, bExtURL);
+            OUString sRelId;
+            if (!sBookmark.isEmpty())
+            {
+                sRelId = mpFB->addRelation(mpFS->getOutputStream(),
+                                           bExtURL ? 
oox::getRelationship(Relationship::HYPERLINK)
+                                                   : 
oox::getRelationship(Relationship::SLIDE),
+                                           sBookmark, bExtURL);
+            }
             if (bExtURL)
                 mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), sRelId);
             else
-                mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), sRelId,
-                                      XML_action, "ppaction://hlinksldjump");
+                mpFS->singleElementNS(
+                    XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId, 
XML_action,
+                    sBookmark.isEmpty() ? "ppaction://noaction" : 
"ppaction://hlinksldjump");
         }
         AddExtLst(pFS, rXPropSet);
         pFS->endElementNS(mnXmlNamespace, XML_cNvPr);

Reply via email to