summaryrefslogtreecommitdiffstats
path: root/sw/source/ui/shells
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-09 15:25:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-09 15:25:31 +0000
commitb2f727aec7cfe94968fb4dec95eaa78b71193bff (patch)
tree89527f3c1f7e72a86c2aa5e6376caf0975011156 /sw/source/ui/shells
parentcoverity#1169838 Dereference null return value (diff)
downloadcore-b2f727aec7cfe94968fb4dec95eaa78b71193bff.tar.gz
core-b2f727aec7cfe94968fb4dec95eaa78b71193bff.zip
coverity#1169837 Dereference null return value
Change-Id: I36d3df9483437a008ff04e254a20b85f2ac042e4
Diffstat (limited to 'sw/source/ui/shells')
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx30
1 files changed, 18 insertions, 12 deletions
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index 43b0dfb54aec..0b5a0b97484d 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -562,17 +562,23 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aSetItem.GetItemSet().Put( aEditAttr, false );
sal_uInt16 nScriptTypes = pOLV->GetSelectedScriptType();
- SvxFontHeightItem aSize( *static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
- sal_uInt32 nSize = aSize.GetHeight();
+ const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
- if( nSlot == FN_GROW_FONT_SIZE && ( nSize += nFontInc ) > nFontMaxSz )
- nSize = nFontMaxSz;
- else if( nSlot == FN_SHRINK_FONT_SIZE && ( nSize -= nFontInc ) < nFontInc )
- nSize = nFontInc;
+ if (pSize)
+ {
+ SvxFontHeightItem aSize(*pSize);
+
+ 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 );
- aNewAttr.Put( aSetItem.GetItemSet() );
+ aSize.SetHeight( nSize );
+ aSetItem.PutItemForScriptType( nScriptTypes, aSize );
+ aNewAttr.Put( aSetItem.GetItemSet() );
+ }
}
break;
@@ -925,13 +931,13 @@ void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pEditPool );
aSetItem.GetItemSet().Put( aEditAttr, false );
- const SvxFontHeightItem* aSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) );
+ const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) );
- if( !aSize )
+ if( !pSize )
rSet.DisableItem( nSlotId );
else
{
- sal_uInt32 nSize = aSize->GetHeight();
+ sal_uInt32 nSize = pSize->GetHeight();
if( nSize == nFontMaxSz )
rSet.DisableItem( FN_GROW_FONT_SIZE );
else if( nSize == nFontInc )