summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-09-01 13:50:06 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-09-02 13:06:04 +0000
commit94a3b4db75ca042ae0e134c8d497d1759f36270b (patch)
tree4162d22fcf01c584ce767ff96d442be6ef008a37
parentc663ffa4a1a5d2ad15a5b114c15ea5484b1dbb9c (diff)
pTemplate can probably be null here
Observed with "make clean && make CppunitTest_sw_filters_test" (which misses a dependency, a bug to be fixed next, so happens to not set up m_pTemplate in SwHTMLWriter::WriteStream, so dereferences a null pTemplate here. Don't know whether there's also legitimate scenarios that can lead to a null pTemplate here, but at least the code in SwHTMLWriter::WriteStream setting up m_pTemplate takes into account that it can be set up as null, and the code in the called SwHTMLWriter::GetTemplateFormat takes into account that the passed in pTemplate (which used to be the same object as the outer pTemplate/pDoc, before breaking IDocumentStylePoolAccess out of SwDoc, see below) can be null. Regression introduced with 535971f3a166da6c0e44a6b7211c7f8c298f388f "Refactored IDocumentStylePoolAccess out of SwDoc." Change-Id: Iabb4ae2ca018ce3a19756d62b9002b245cb409cd (cherry picked from commit bf3c6237bb110d3eb84970e44593a7880e2e8536) Reviewed-on: https://gerrit.libreoffice.org/28591 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/filter/html/css1atr.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index b5690e80ed9e..551c83906f3e 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -1562,16 +1562,16 @@ static Writer& OutCSS1_SwFormat( Writer& rWrt, const SwFormat& rFormat,
switch( nDeep )
{
case CSS1_FMT_ISTAG:
- pRefFormat = SwHTMLWriter::GetTemplateFormat( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() );
+ pRefFormat = SwHTMLWriter::GetTemplateFormat( nRefPoolId, pTemplate == nullptr ? nullptr : &pTemplate->getIDocumentStylePoolAccess() );
break;
case CSS1_FMT_CMPREF:
pRefFormat = SwHTMLWriter::GetTemplateFormat( nRefPoolId, pDoc );
- pRefFormatScript = SwHTMLWriter::GetTemplateFormat( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() );
+ pRefFormatScript = SwHTMLWriter::GetTemplateFormat( nRefPoolId, pTemplate == nullptr ? nullptr : &pTemplate->getIDocumentStylePoolAccess() );
bClearSame = false;
break;
default:
pRefFormat = SwHTMLWriter::GetParentFormat( rFormat, nDeep );
- pRefFormatScript = SwHTMLWriter::GetTemplateFormat( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() );
+ pRefFormatScript = SwHTMLWriter::GetTemplateFormat( nRefPoolId, pTemplate == nullptr ? nullptr : &pTemplate->getIDocumentStylePoolAccess() );
bSetDefaults = false;
break;
}