[Libreoffice-commits] core.git: xmloff/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 26 06:42:03 UTC 2019


 xmloff/source/text/txtparae.cxx |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 08b6daa63e7b5aac6c301da3224af3f31c9434f9
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jul 25 14:24:33 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jul 26 08:41:04 2019 +0200

    HACK to survive missing target storage
    
    ...during e.g. `convert-to fodt doc/ooo108999-1.doc` (i.e., the attachment
    tytret2010.doc at <https://bz.apache.org/ooo/show_bug.cgi?id=108999#c2>).  It
    appears that the call to SwXMLWriter::Write_ to set the "TargetStorage" property
    is missing in this scenario (which is done for convert-to odt), but it is
    unclear what a proper fix should look like.
    
    Change-Id: I4beab4d8891fc0222bc0867ea53c3d9307be20dd
    Reviewed-on: https://gerrit.libreoffice.org/76314
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 1cbc325f604d..5a9ebfcb3dfd 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -476,20 +476,24 @@ void FieldParamExporter::Export()
             {
                 // Save the OLE object
                 Reference< embed::XStorage > xTargetStg = m_pExport->GetTargetStorage();
-                Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
+                if (xTargetStg.is()) {
+                    Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
                         "OLELinks", embed::ElementModes::WRITE );
 
-                if ( !xDstStg->hasByName( sValue ) ) {
-                    Reference< XStorageBasedDocument > xStgDoc (
+                    if ( !xDstStg->hasByName( sValue ) ) {
+                        Reference< XStorageBasedDocument > xStgDoc (
                             m_pExport->GetModel( ), UNO_QUERY );
-                    Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
-                    Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
+                        Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
+                        Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
                             "OLELinks", embed::ElementModes::READ );
 
-                    xOleStg->copyElementTo( sValue, xDstStg, sValue );
-                    Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
-                    if ( xTransact.is( ) )
-                        xTransact->commit( );
+                        xOleStg->copyElementTo( sValue, xDstStg, sValue );
+                        Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
+                        if ( xTransact.is( ) )
+                            xTransact->commit( );
+                    }
+                } else {
+                    SAL_WARN("xmloff", "no target storage");
                 }
             }
         }


More information about the Libreoffice-commits mailing list