sd/source/ui/unoidl/unomodel.cxx | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-)
New commits: commit a6f425685ed7ad6b86cff91b5fe0a383108bde1c Author: Caolán McNamara <[email protected]> AuthorDate: Mon Oct 13 12:39:09 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Nov 2 22:08:58 2025 +0100 abandon early if slide has no page which can only happen if the slide is disposing/disposed Change-Id: I8fd72bff93f72e4a9c5ed827905c58db2a56fdb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192282 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index efb3a0bd52a6..3c58264f597a 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -4683,10 +4683,16 @@ OString SdXImpressDocument::getPresentationInfo(bool bAllyState) const for (sal_Int32 i = 0; i < nSlideCount; ++i) { SdGenericDrawPage* pSlide(xDrawPages->getDrawPageByIndex(i)); + SdPage* pPage = SdPage::getImplementation(pSlide); + if (!pPage) + { + SAL_WARN("sd", "slide: " << i << " is disposed, skipping"); + continue; + } + bool bIsVisible = true; // default visible pSlide->getPropertyValue("Visible") >>= bIsVisible; - SdPage* pPage = SdPage::getImplementation(pSlide); if (!bIsVisible) { auto aSlideNode = aJsonWriter.startStruct(); @@ -4704,25 +4710,22 @@ OString SdXImpressDocument::getPresentationInfo(bool bAllyState) const aJsonWriter.put("index", i); aJsonWriter.put("uniqueID", pPage->GetUniqueID()); - if (pPage) - { - auto aName = SdDrawPage::getPageApiNameFromUiName(pPage->GetName()); - aJsonWriter.put("name", aName); + auto aName = SdDrawPage::getPageApiNameFromUiName(pPage->GetName()); + aJsonWriter.put("name", aName); - const Size aSlizeSize = const_cast<SdXImpressDocument*>(this)->getPartSize(i); - aJsonWriter.put("slideWidth", aSlizeSize.getWidth()); - aJsonWriter.put("slideHeight", aSlizeSize.getHeight()); + const Size aSlizeSize = const_cast<SdXImpressDocument*>(this)->getPartSize(i); + aJsonWriter.put("slideWidth", aSlizeSize.getWidth()); + aJsonWriter.put("slideHeight", aSlizeSize.getHeight()); - if (bAllyState) + if (bAllyState) + { + OUStringBuffer aHtml; + SdrOutliner* pOutliner = mpDoc->GetInternalOutliner(); + if (pOutliner) { - OUStringBuffer aHtml; - SdrOutliner* pOutliner = mpDoc->GetInternalOutliner(); - if (pOutliner) - { - SdHTMLFilter::ExportPage(pOutliner, pPage, aHtml); - aJsonWriter.put("a11y", aHtml.makeStringAndClear()); - pOutliner->Clear(); - } + SdHTMLFilter::ExportPage(pOutliner, pPage, aHtml); + aJsonWriter.put("a11y", aHtml.makeStringAndClear()); + pOutliner->Clear(); } } @@ -4730,7 +4733,7 @@ OString SdXImpressDocument::getPresentationInfo(bool bAllyState) const aJsonWriter.put("empty", bIsDrawPageEmpty); // Notes - SdPage* pNotesPage = pPage ? mpDoc->GetSdPage((pPage->GetPageNum() - 1) >> 1, PageKind::Notes) : nullptr; + SdPage* pNotesPage = mpDoc->GetSdPage((pPage->GetPageNum() - 1) >> 1, PageKind::Notes); if (pNotesPage) { SdrObject* pItObj = nullptr;
