diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-06 13:47:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-06 16:35:50 +0000 |
commit | ca789f8ea47e20788f577f74b70b9e110aad8158 (patch) | |
tree | e32c77d0fb3260aaa61b4e88daf3138354b9cc5c /editeng | |
parent | cfb2d0fe2f38d112e901c20e6ac8e04cdfde08aa (diff) |
coverity#1190356 Dereference null return value
Change-Id: I9a857423cd190b2da9f535e8897a9c9baba40b73
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/numitem.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 2a1a348189ca..e49e0c32a270 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -814,11 +814,21 @@ void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, bool bI { 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 ]; - aFmts[ i ] = new SvxNumberFormat( rNumFmt ); - aFmtsSet[i] = bIsValid; + bool bReplace = !aFmtsSet[i]; + 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; + } } } |