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:03:25 +0000
commit1de7b0009a09d3cc819ba86e8dd26f846656ae79 (patch)
treefcc8bda94e8f36be6f80c6663276acb7f8a004db
parent438a76a9a261b9ada7b2758a66cd935d1760da39 (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/28589 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 2394ed9c8765..97cd06e84ccd 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -1561,16 +1561,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;
}