Kaydet (Commit) 581ffdd2 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1187675 Dereference null return value

Change-Id: I313772d7382c303990f7333990e340803678be79
üst 3a1671b3
...@@ -1719,12 +1719,10 @@ const OUString& PrintFontManager::getPSName( fontID nFontID ) const ...@@ -1719,12 +1719,10 @@ const OUString& PrintFontManager::getPSName( fontID nFontID ) const
return m_pAtoms->getString( ATOM_PSNAME, pFont ? pFont->m_nPSName : INVALID_ATOM ); return m_pAtoms->getString( ATOM_PSNAME, pFont ? pFont->m_nPSName : INVALID_ATOM );
} }
int PrintFontManager::getFontAscend( fontID nFontID ) const int PrintFontManager::getFontAscend( fontID nFontID ) const
{ {
PrintFont* pFont = getFont( nFontID ); 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 // might be a truetype font not yet analyzed
if( pFont->m_eType == fonttype::TrueType ) if( pFont->m_eType == fonttype::TrueType )
...@@ -1732,15 +1730,13 @@ int PrintFontManager::getFontAscend( fontID nFontID ) const ...@@ -1732,15 +1730,13 @@ int PrintFontManager::getFontAscend( fontID nFontID ) const
else if( pFont->m_eType == fonttype::Type1 ) else if( pFont->m_eType == fonttype::Type1 )
pFont->readAfmMetrics( m_pAtoms, false, true ); pFont->readAfmMetrics( m_pAtoms, false, true );
} }
return pFont->m_nAscend; return pFont ? pFont->m_nAscend : 0;
} }
int PrintFontManager::getFontDescend( fontID nFontID ) const int PrintFontManager::getFontDescend( fontID nFontID ) const
{ {
PrintFont* pFont = getFont( nFontID ); 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 // might be a truetype font not yet analyzed
if( pFont->m_eType == fonttype::TrueType ) if( pFont->m_eType == fonttype::TrueType )
...@@ -1748,11 +1744,9 @@ int PrintFontManager::getFontDescend( fontID nFontID ) const ...@@ -1748,11 +1744,9 @@ int PrintFontManager::getFontDescend( fontID nFontID ) const
else if( pFont->m_eType == fonttype::Type1 ) else if( pFont->m_eType == fonttype::Type1 )
pFont->readAfmMetrics( m_pAtoms, false, true ); pFont->readAfmMetrics( m_pAtoms, false, true );
} }
return pFont->m_nDescend; return pFont ? pFont->m_nDescend : 0;
} }
void PrintFontManager::hasVerticalSubstitutions( fontID nFontID, void PrintFontManager::hasVerticalSubstitutions( fontID nFontID,
const sal_Unicode* pCharacters, int nCharacters, bool* pHasSubst ) const const sal_Unicode* pCharacters, int nCharacters, bool* pHasSubst ) const
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment