oox/source/ppt/presentationfragmenthandler.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit f6b2bef0fc46bf6e087950cf712b79bf7d0bb2be
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sun Jun 12 17:21:12 2022 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Sep 8 11:47:39 2022 +0200

    tdf#150770: crashtesting: assert seen on loading forum-mso-en-2633.pptx
    
    probably since:
    
    commit 855a56fea4561135a63cb729d7a625a950b210e7
    Date:   Fri May 13 08:12:17 2022 +0200
    
        tdf#148965 PPTX import: fix internal hyperlinks on shapes
    
    Change-Id: I920cbbb5544cbe9d76f37b3d524c9ccebd426132
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135682
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 48de2ac37366d5671aabc64364660311431d3235)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139570
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index b0a7b7ec0fd3..ac1e32e533ec 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -112,15 +112,17 @@ static void 
lcl_setBookmark(uno::Reference<drawing::XShape>& rShape,
                             std::vector<SlidePersistPtr>& rSlidePersist)
 {
     OUString aBookmark;
-    sal_Int32 nPageNumber;
     static const OUStringLiteral sSlideName = u"#page";
     uno::Reference<beans::XPropertySet> xPropSet(rShape, uno::UNO_QUERY);
     xPropSet->getPropertyValue("Bookmark") >>= aBookmark;
-    nPageNumber = o3tl::toInt32(aBookmark.subView(sSlideName.getLength()));
-    Reference<XDrawPage> xDrawPage(rSlidePersist[nPageNumber - 1]->getPage());
-    Reference<container::XNamed> xNamed(xDrawPage, UNO_QUERY_THROW);
-    aBookmark = xNamed->getName();
-    xPropSet->setPropertyValue("Bookmark", Any(aBookmark));
+    if (aBookmark.startsWith(sSlideName))
+    {
+        sal_Int32 nPageNumber = 
o3tl::toInt32(aBookmark.subView(sSlideName.getLength()));
+        Reference<XDrawPage> xDrawPage(rSlidePersist[nPageNumber - 
1]->getPage());
+        Reference<container::XNamed> xNamed(xDrawPage, UNO_QUERY_THROW);
+        aBookmark = xNamed->getName();
+        xPropSet->setPropertyValue("Bookmark", Any(aBookmark));
+    }
 }
 
 static void ResolveShapeBookmark(std::vector<SlidePersistPtr>& rSlidePersist)

Reply via email to