sc/source/ui/unoobj/docuno.cxx | 54 +++++++++++++++++---------------- sfx2/source/sidebar/ControllerItem.cxx | 2 - 2 files changed, 29 insertions(+), 27 deletions(-)
New commits: commit cda5ecdefe5a52184930aba56c2af20a8c30622d Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Mar 17 21:23:11 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Mar 18 15:31:06 2024 +0100 cid#1594402 Unchecked dynamic_cast Change-Id: I01218f7c457b23539ca911ab1bf4a910198285b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164954 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index eef74952df9a..a9bf8cc3c0c9 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2354,32 +2354,34 @@ static void lcl_SetMediaScreen(const uno::Reference<drawing::XShape>& xMediaShap OUString sMediaURL; uno::Reference<beans::XPropertySet> xPropSet(xMediaShape, uno::UNO_QUERY); xPropSet->getPropertyValue("MediaURL") >>= sMediaURL; - if (!sMediaURL.isEmpty()) - { - OUString sTitle; - xPropSet->getPropertyValue("Title") >>= sTitle; - OUString sDescription; - xPropSet->getPropertyValue("Description") >>= sDescription; - OUString const altText(sTitle.isEmpty() ? sDescription - : sDescription.isEmpty() - ? sTitle - : OUString::Concat(sTitle) + OUString::Concat(" ") - + OUString::Concat(sDescription)); - - OUString const mimeType(xPropSet->getPropertyValue("MediaMimeType").get<OUString>()); - SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape)); - vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); - sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, nPageNumb, pSdrObj); - if (sMediaURL.startsWith("vnd.sun.star.Package:")) - { - // Embedded media - OUString aTempFileURL; - xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL; - pPDF->SetScreenStream(nScreenId, aTempFileURL); - } - else // Linked media - pPDF->SetScreenURL(nScreenId, sMediaURL); - } + if (sMediaURL.isEmpty()) + return; + vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); + if (!pPDF) + return; + + OUString sTitle; + xPropSet->getPropertyValue("Title") >>= sTitle; + OUString sDescription; + xPropSet->getPropertyValue("Description") >>= sDescription; + OUString const altText(sTitle.isEmpty() ? sDescription + : sDescription.isEmpty() + ? sTitle + : OUString::Concat(sTitle) + OUString::Concat(" ") + + OUString::Concat(sDescription)); + + OUString const mimeType(xPropSet->getPropertyValue("MediaMimeType").get<OUString>()); + SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape)); + sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, nPageNumb, pSdrObj); + if (sMediaURL.startsWith("vnd.sun.star.Package:")) + { + // Embedded media + OUString aTempFileURL; + xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL; + pPDF->SetScreenStream(nScreenId, aTempFileURL); + } + else // Linked media + pPDF->SetScreenURL(nScreenId, sMediaURL); } static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const ScPrintState& rState, commit 3228b3966522c27ebe009a0abfdcabea37053865 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Mar 17 21:20:09 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Mar 18 15:30:59 2024 +0100 cid#1594401 Explicit null dereferenced Change-Id: I0ab5cedcf5c573fa00aca4c51f021251974337ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164953 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index 28248710f1a6..e84ab9b1f2e3 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -64,7 +64,7 @@ void ControllerItem::RequestUpdate() { std::unique_ptr<SfxPoolItem> pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); - if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) + if (GetId() == SID_ATTR_METRIC && pState && comphelper::LibreOfficeKit::isActive()) { MeasurementSystem eSystem = LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum();