coverity#1190356 Dereference null return value

Change-Id: I9a857423cd190b2da9f535e8897a9c9baba40b73
This commit is contained in:
Caolán McNamara
2014-03-06 13:47:17 +00:00
parent cfb2d0fe2f
commit ca789f8ea4

View File

@@ -814,12 +814,22 @@ void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, bool bI
{ {
DBG_ASSERT(i < SVX_MAX_NUM, "Wrong Level" ); DBG_ASSERT(i < SVX_MAX_NUM, "Wrong Level" );
if( (i < SVX_MAX_NUM) && (!aFmtsSet[i] || !(rNumFmt == *Get( i ))) ) if( (i < SVX_MAX_NUM) )
{ {
delete aFmts[ i ]; bool bReplace = !aFmtsSet[i];
aFmts[ i ] = new SvxNumberFormat( rNumFmt ); if (!bReplace)
{
const SvxNumberFormat *pFmt = Get(i);
bReplace = pFmt ? rNumFmt != *pFmt : true;
}
if (bReplace)
{
delete aFmts[i];
aFmts[i] = new SvxNumberFormat(rNumFmt);
aFmtsSet[i] = bIsValid; aFmtsSet[i] = bIsValid;
} }
}
} }
void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt) void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt)