sw/source/filter/html/htmlfldw.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0d9f0c0f7c90f63d5803a3e1cc27979b505fa03a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Apr 19 09:17:21 2023 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Apr 20 08:30:17 2023 +0200

    sw: fix crash in OutHTML_SwFormatField()
    
    Crashreport signature:
    
    program/libswlo.so
            SwDocShell::GetView()
                    sw/inc/docsh.hxx:222
    program/libswlo.so
            OutHTML_SwFormatField(Writer&, SfxPoolItem const&)
                    sw/source/filter/html/htmlfldw.cxx:549
    ...
    program/libswlo.so
            SwTransferable::WriteObject(tools::SvRef<SotTempStream>&, void*, 
unsigned int, com::sun::star::datatransfer::DataFlavor const&)
                    sw/source/uibase/dochdl/swdtflvr.cxx:?
    
    I.e. clipboard documents don't have a doc shell, handle that.
    
    Change-Id: I48b22087f759a11b4aa46b83b310f4a661e1fbc4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150596
    Tested-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/filter/html/htmlfldw.cxx 
b/sw/source/filter/html/htmlfldw.cxx
index 2d3e6c4ca4d1..9da104508b8f 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -543,7 +543,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const 
SfxPoolItem& rHt )
     {
         const SwTextField *pTextField = rField.GetTextField();
         OSL_ENSURE( pTextField, "Where is the txt fld?" );
-        if( pTextField )
+        if( pTextField && rWrt.m_pDoc->GetDocShell() )
         {
             // ReqIF-XHTML doesn't allow specifying a background color.
             const SwViewOption* pViewOptions = 
rWrt.m_pDoc->GetDocShell()->GetView()->GetWrtShell().GetViewOptions();

Reply via email to