This is an automated email from the ASF dual-hosted git repository. ardovm pushed a commit to branch ppt in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit b622dd6d9d2607212ada7fd2dd4e4951e49eb0d6 Author: Arrigo Marchiori <ard...@yahoo.it> AuthorDate: Fri Dec 9 17:08:24 2022 +0100 Check validity of page descriptors --- main/sd/source/filter/ppt/pptin.cxx | 15 ++++++++++++--- main/svx/source/svdraw/svdpage.cxx | 12 ++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/main/sd/source/filter/ppt/pptin.cxx b/main/sd/source/filter/ppt/pptin.cxx index c79c05ddf9..5d5936ccd6 100644 --- a/main/sd/source/filter/ppt/pptin.cxx +++ b/main/sd/source/filter/ppt/pptin.cxx @@ -2487,9 +2487,18 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( pSlideLayout->aPlacementId[ i ] != (sal_uLong)-1 ) ) { - SdrObject* pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE ); - SdrObject* pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE ); - + SdrObject* pTitleObj; + try { + pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE ); + } catch (uno::Exception &) { + pTitleObj = NULL; + } + SdrObject* pOutlineObj; + try { + pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE ); + } catch (uno::Exception &) { + pOutlineObj = NULL; + } Rectangle aTitleRect; Rectangle aOutlineRect; Size aOutlineSize; diff --git a/main/svx/source/svdraw/svdpage.cxx b/main/svx/source/svdraw/svdpage.cxx index 3507bbfb8e..ca12e75818 100644 --- a/main/svx/source/svdraw/svdpage.cxx +++ b/main/svx/source/svdraw/svdpage.cxx @@ -1768,24 +1768,36 @@ void SdrPage::TRG_ClearMasterPage() SdrPage& SdrPage::TRG_GetMasterPage() const { DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_GetMasterPage(): No MasterPage available. Use TRG_HasMasterPage() before access (!)"); + if (mpMasterPageDescriptor == NULL) { + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No master page descriptor")), NULL); + } return mpMasterPageDescriptor->GetUsedPage(); } const SetOfByte& SdrPage::TRG_GetMasterPageVisibleLayers() const { DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_GetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)"); + if (mpMasterPageDescriptor == NULL) { + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No master page descriptor")), NULL); + } return mpMasterPageDescriptor->GetVisibleLayers(); } void SdrPage::TRG_SetMasterPageVisibleLayers(const SetOfByte& rNew) { DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_SetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)"); + if (mpMasterPageDescriptor == NULL) { + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No master page descriptor")), NULL); + } mpMasterPageDescriptor->SetVisibleLayers(rNew); } sdr::contact::ViewContact& SdrPage::TRG_GetMasterPageDescriptorViewContact() const { DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_GetMasterPageDescriptorViewContact(): No MasterPage available. Use TRG_HasMasterPage() before access (!)"); + if (mpMasterPageDescriptor == NULL) { + throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No master page descriptor")), NULL); + } return mpMasterPageDescriptor->GetViewContact(); }