summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2024-04-28 13:16:59 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-04-29 20:22:58 +0200
commitbb71d3949bbccc6c731933e2cd1e32b9b1080ddc (patch)
tree66f1bd731cda7ab90b30c260dccbd5241e75efe6
parent77c26dae7c984f5c60206091f87897079c8a5d93 (diff)
tdf#160827: fix crash when retrieving _MarkAsFinal value (docx) (take 2)
Change-Id: I3f2ad56a205877be54b0dbfe361b76db3436f5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166798 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins (cherry picked from commit 45d2d90d2354a6a32297cde52c0041915499b19b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166726 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 2ed402dada3b8b64c6f23cf5afc068848ab1a528) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166839 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sfx2/source/doc/objstor.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 17ee6bf6217d..a6aaee75ea87 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2428,7 +2428,11 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium,
uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName("_MarkAsFinal"))
{
- if (xPropertySet->getPropertyValue("_MarkAsFinal").get<bool>())
+ Any anyMarkAsFinal = xPropertySet->getPropertyValue("_MarkAsFinal");
+ if (
+ ( (anyMarkAsFinal.getValueType() == cppu::UnoType<bool>::get()) && (anyMarkAsFinal.get<bool>()) ) ||
+ ( (anyMarkAsFinal.getValueType() == cppu::UnoType<OUString>::get()) && (anyMarkAsFinal.get<OUString>() == "true") )
+ )
{
uno::Reference< lang::XMultiServiceFactory > xFactory(GetModel(), uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);