summaryrefslogtreecommitdiffstats
path: root/sw/source/ui/shells
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-09 15:22:45 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-09 15:22:45 +0000
commit39ecb2470c21c842559e8ac2c4d78c8e1e3cf880 (patch)
treedeaf9539ce308960a7dc28973178b3fe52a3cc2e /sw/source/ui/shells
parentcoverity#1169839 Unintentional integer overflow (diff)
downloadcore-39ecb2470c21c842559e8ac2c4d78c8e1e3cf880.tar.gz
core-39ecb2470c21c842559e8ac2c4d78c8e1e3cf880.zip
coverity#1169838 Dereference null return value
Change-Id: I6e8f83569fdb1ee7d7f513e065e6233aecf140f4
Diffstat (limited to 'sw/source/ui/shells')
-rw-r--r--sw/source/ui/shells/txtattr.cxx40
1 files changed, 24 insertions, 16 deletions
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 14519822860c..c52aaa29d9df 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -226,22 +226,30 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() );
sal_uInt16 nScriptTypes = rWrtSh.GetScriptType();
- SvxFontHeightItem aSize( *static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
- sal_uInt32 nSize = aSize.GetHeight();
- if ( nSlot == FN_GROW_FONT_SIZE && ( nSize += nFontInc ) > nFontMaxSz )
- nSize = nFontMaxSz;
- else if ( nSlot == FN_SHRINK_FONT_SIZE && ( nSize -= nFontInc ) < nFontInc )
- nSize = nFontInc;
+ const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>(
+ aSetItem.GetItemOfScript( nScriptTypes ) ) );
- aSize.SetHeight( nSize );
- aSetItem.PutItemForScriptType( nScriptTypes, aSize );
- aAttrSet.Put( aSetItem.GetItemSet() );
+ if (pSize)
+ {
+ SvxFontHeightItem aSize(*pSize);
- if( pColl )
- pColl->SetFmtAttr( aAttrSet );
- else
- rWrtSh.SetAttrSet( aAttrSet );
+ sal_uInt32 nSize = aSize.GetHeight();
+
+ if ( nSlot == FN_GROW_FONT_SIZE && ( nSize += nFontInc ) > nFontMaxSz )
+ nSize = nFontMaxSz;
+ else if ( nSlot == FN_SHRINK_FONT_SIZE && ( nSize -= nFontInc ) < nFontInc )
+ nSize = nFontInc;
+
+ aSize.SetHeight( nSize );
+ aSetItem.PutItemForScriptType( nScriptTypes, aSize );
+ aAttrSet.Put( aSetItem.GetItemSet() );
+
+ if( pColl )
+ pColl->SetFmtAttr( aAttrSet );
+ else
+ rWrtSh.SetAttrSet( aAttrSet );
+ }
rReq.Done();
}
@@ -598,14 +606,14 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet)
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT,
*rSet.GetPool() );
aSetItem.GetItemSet().Put( aCoreSet, false );
- const SvxFontHeightItem* aSize( static_cast<const SvxFontHeightItem*>(
+ const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>(
aSetItem.GetItemOfScript( rSh.GetScriptType() ) ) );
- if( !aSize )
+ if( !pSize )
rSet.DisableItem( nSlot );
else
{
- sal_uInt32 nSize = aSize->GetHeight();
+ sal_uInt32 nSize = pSize->GetHeight();
if( nSize == nFontMaxSz )
rSet.DisableItem( FN_GROW_FONT_SIZE );
else if( nSize == nFontInc )