sfx2/source/doc/objstor.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 45d2d90d2354a6a32297cde52c0041915499b19b
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Apr 28 13:16:59 2024 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Apr 28 20:10:30 2024 +0200

    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.gran...@collabora.co.uk>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 720e939e3885..e7538813cfdd 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2741,7 +2741,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);

Reply via email to