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

New commits:
commit 48de2ac37366d5671aabc64364660311431d3235
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Jun 12 17:21:12 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jun 13 06:54:39 2022 +0200

    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 <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index c9deec076edc..43b7f105a1c4 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -110,15 +110,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