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

New commits:
commit 08b6daa63e7b5aac6c301da3224af3f31c9434f9
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Jul 25 14:24:33 2019 +0200
Commit:     Stephan Bergmann <sberg...@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 <sberg...@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");
                 }
             }
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to