sd/qa/unit/data/odp/tdf169438_invalid_audio_link.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx                   |   15 +++++++++++++++
 sd/source/filter/eppt/pptx-animations.cxx            |    4 ++++
 3 files changed, 19 insertions(+)

New commits:
commit d93ff51910f2c61949460eecc6fe6c0348ca652b
Author:     Aron Budea <[email protected]>
AuthorDate: Fri Nov 28 00:35:52 2025 +1030
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Nov 28 21:07:46 2025 +0100

    tdf#169438 sd: reference to missing audio results in invalid PPTX
    
    In slideX.xml the 'p:sndTgt' element would be incomplete.
    
    Happened since d98d3e2a0bc087ec9157e8e32e9f0ea4207d36e2.
    
    Change-Id: I3af20cc95abb86db393b6e2a03af379b8dc51360
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194706
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 0cf6caa3c267805dc99c8c138656f901879e80fa)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194786
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sd/qa/unit/data/odp/tdf169438_invalid_audio_link.odp 
b/sd/qa/unit/data/odp/tdf169438_invalid_audio_link.odp
new file mode 100644
index 000000000000..68a3c01468d7
Binary files /dev/null and 
b/sd/qa/unit/data/odp/tdf169438_invalid_audio_link.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 205177ea3df4..ced1ad00d9ab 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -1004,6 +1004,21 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf44223)
     assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Target", 
u"../media/audio1.wav");
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testtdf169438_invalid_audio_link)
+{
+    createSdImpressDoc("odp/tdf169438_invalid_audio_link.odp");
+    save(TestFilter::PPTX);
+
+    xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr);
+
+    // Without the patch the incompleet audio node would be exported
+    int nAudioNode = countXPathNodes(
+        pXmlDoc, 
"//p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
+                 
"p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
+                 "p:childTnLst/p:audio");
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no audio node in the XML", 
0, nAudioNode);
+}
+
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf135843)
 {
     createSdImpressDoc("pptx/tdf135843_export.pptx");
diff --git a/sd/source/filter/eppt/pptx-animations.cxx 
b/sd/source/filter/eppt/pptx-animations.cxx
index 48c3376cd1bf..9d64fdb77acc 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -1130,6 +1130,10 @@ void PPTXAnimationExport::WriteAnimationNodeMedia(const 
sal_Int16 nParentNodeTyp
         if (!convertEffectNodeType(nParentNodeType))
             return;
 
+        // Don't export audio node if embedding audio was unsuccessful
+        if (!xShape.is() && (sRelId.isEmpty() || sUrl.isEmpty()))
+            return;
+
         bool bNarration = xAudio->getNarration();
         mpFS->startElementNS(XML_p, XML_audio, XML_isNarration, bNarration ? 
"1" : "0");
         bool bHideDuringShow = xAudio->getHideDuringShow();

Reply via email to