summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-27 10:47:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-27 12:58:44 +0000
commit581ffdd2864c2c0c9c4011fd3221d54c363f2452 (patch)
tree98d1ef426bbd6d4fdba65ac90ea6a7e2c99d7886
parent3a1671b35198316af21f8f2d62233aa66e4b30f0 (diff)
coverity#1187675 Dereference null return value
Change-Id: I313772d7382c303990f7333990e340803678be79
-rw-r--r--vcl/generic/fontmanager/fontmanager.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index d976ad196501..e5854a310579 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1719,12 +1719,10 @@ const OUString& PrintFontManager::getPSName( fontID nFontID ) const
return m_pAtoms->getString( ATOM_PSNAME, pFont ? pFont->m_nPSName : INVALID_ATOM );
}
-
-
int PrintFontManager::getFontAscend( fontID nFontID ) const
{
PrintFont* pFont = getFont( nFontID );
- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
+ if (pFont && pFont->m_nAscend == 0 && pFont->m_nDescend == 0)
{
// might be a truetype font not yet analyzed
if( pFont->m_eType == fonttype::TrueType )
@@ -1732,15 +1730,13 @@ int PrintFontManager::getFontAscend( fontID nFontID ) const
else if( pFont->m_eType == fonttype::Type1 )
pFont->readAfmMetrics( m_pAtoms, false, true );
}
- return pFont->m_nAscend;
+ return pFont ? pFont->m_nAscend : 0;
}
-
-
int PrintFontManager::getFontDescend( fontID nFontID ) const
{
PrintFont* pFont = getFont( nFontID );
- if( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
+ if (pFont && pFont->m_nAscend == 0 && pFont->m_nDescend == 0)
{
// might be a truetype font not yet analyzed
if( pFont->m_eType == fonttype::TrueType )
@@ -1748,11 +1744,9 @@ int PrintFontManager::getFontDescend( fontID nFontID ) const
else if( pFont->m_eType == fonttype::Type1 )
pFont->readAfmMetrics( m_pAtoms, false, true );
}
- return pFont->m_nDescend;
+ return pFont ? pFont->m_nDescend : 0;
}
-
-
void PrintFontManager::hasVerticalSubstitutions( fontID nFontID,
const sal_Unicode* pCharacters, int nCharacters, bool* pHasSubst ) const
{