From a48d2d28ed69a076ac5705c62165c6bf8049e813 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 11 Aug 2011 17:16:30 +0200 Subject: avoid crash when writting comments --- sw/source/filter/ww8/docxattributeoutput.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index da091ee7ed7d..c66bb9df749b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3333,7 +3333,11 @@ void DocxAttributeOutput::WritePostitFields() m_pSerializer->startElementNS( XML_w, XML_comment, FSNS( XML_w, XML_id ), idstr.getStr(), FSNS( XML_w, XML_author ), rtl::OUStringToOString( f->GetPar1(), RTL_TEXTENCODING_UTF8 ).getStr(), FSNS( XML_w, XML_date ), impl_DateTimeToOString(f->GetDateTime()).getStr(), FSEND ); - GetExport().WriteOutliner( *f->GetTextObject(), TXT_ATN ); + // Check for the text object existing, it seems that it can be NULL when saving a newly created + // comment without giving focus back to the main document. As GetTxt() is empty in that case as well, + // that is probably a bug in the Writer core. + if( f->GetTextObject() != NULL ) + GetExport().WriteOutliner( *f->GetTextObject(), TXT_ATN ); m_pSerializer->endElementNS( XML_w, XML_comment ); } } -- cgit