From d8e7624c9a874aee3ab782715117b118ddd0c496 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 19 Jun 2014 17:51:36 +0200 Subject: Do not dereference null pointer ...and XMLTextCharStyleNamesElementExport only requires a non-null rPropSet arg when its bDoSomething arg is true. Reported by CppunitTest_sw_odfexport under -sanitize=undefined. Change-Id: Ia45fa7db250f83d746829c7f411e78bbc50bf721 --- xmloff/source/text/txtparae.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 7c91085ffd96..108fe8ea53f1 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2843,11 +2843,12 @@ void XMLTextParagraphExport::exportAnyTextFrame( else bIsUICharStyle = false; + bool bDoSomething = bIsUICharStyle + && aCharStyleNamesPropInfoCache.hasProperty( *pRangePropSet ); XMLTextCharStyleNamesElementExport aCharStylesExport( - GetExport(), bIsUICharStyle && - aCharStyleNamesPropInfoCache.hasProperty( - *pRangePropSet ), bHasAutoStyle, - *pRangePropSet, sCharStyleNames ); + GetExport(), bDoSomething, bHasAutoStyle, + bDoSomething ? *pRangePropSet : Reference(), + sCharStyleNames ); if( !sStyle.isEmpty() ) GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, -- cgit