coverity#704628/704629/704630 Explicit null dereferenced

+ return early if no whichid or after default case

Change-Id: I40f3ec310604ccde22022dd2e82984b0f3057307
Reviewed-on: https://gerrit.libreoffice.org/2869
Reviewed-by: Noel Power <noel.power@suse.com>
Tested-by: Noel Power <noel.power@suse.com>
This commit is contained in:
Julien Nabet
2013-03-20 13:23:34 +01:00
committed by Noel Power
parent 2c108a29d1
commit d96dd35771

View File

@@ -148,10 +148,9 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
break; break;
} }
if( DOUBLEBYTE_CHARTYPE == eType ) if( DOUBLEBYTE_CHARTYPE == eType )
{ {
if( bIsLeftToRightDef && *pCJK ) if( bIsLeftToRightDef && pCJK )
{ {
rItem.SetWhich( *pCJK ); rItem.SetWhich( *pCJK );
rSet.Put( rItem ); rSet.Put( rItem );
@@ -159,7 +158,7 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
} }
else if( !bIsLeftToRightDef ) else if( !bIsLeftToRightDef )
{ {
if( *pCTL ) if( pCTL )
{ {
rItem.SetWhich( *pCTL ); rItem.SetWhich( *pCTL );
rSet.Put( rItem ); rSet.Put( rItem );
@@ -169,7 +168,7 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
{ {
if( LOW_CHARTYPE == eType ) if( LOW_CHARTYPE == eType )
{ {
if( *pNormal ) if( pNormal )
{ {
rItem.SetWhich( *pNormal ); rItem.SetWhich( *pNormal );
rSet.Put( rItem ); rSet.Put( rItem );
@@ -177,7 +176,7 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
} }
else if( HIGH_CHARTYPE == eType ) else if( HIGH_CHARTYPE == eType )
{ {
if( *pCTL ) if( pCTL )
{ {
rItem.SetWhich( *pCTL ); rItem.SetWhich( *pCTL );
rSet.Put( rItem ); rSet.Put( rItem );
@@ -185,17 +184,17 @@ void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
} }
else else
{ {
if( *pCJK ) if( pCJK )
{ {
rItem.SetWhich( *pCJK ); rItem.SetWhich( *pCJK );
rSet.Put( rItem ); rSet.Put( rItem );
} }
if( *pCTL ) if( pCTL )
{ {
rItem.SetWhich( *pCTL ); rItem.SetWhich( *pCTL );
rSet.Put( rItem ); rSet.Put( rItem );
} }
if( *pNormal ) if( pNormal )
{ {
rItem.SetWhich( *pNormal ); rItem.SetWhich( *pNormal );
rSet.Put( rItem ); rSet.Put( rItem );