Kaydet (Commit) 9e11fb7c authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1435548 rework to avoid Dereference after null check warning

Change-Id: Ifb0d6af999e4935009669a7f85a77e640ce0eddc
Reviewed-on: https://gerrit.libreoffice.org/54138Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 95d5fc76
......@@ -333,23 +333,22 @@ void FreetypeManager::ClearFontList( )
FreetypeFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD )
{
FreetypeFontInfo* pFontInfo = nullptr;
// find a FontInfo matching to the font id
sal_IntPtr nFontId = 0;
if (rFSD.mpFontInstance && rFSD.mpFontInstance->GetFontFace())
nFontId = rFSD.mpFontInstance->GetFontFace()->GetFontId();
if (!rFSD.mpFontInstance)
return nullptr;
const PhysicalFontFace* pFontFace = rFSD.mpFontInstance->GetFontFace();
if (!pFontFace)
return nullptr;
sal_IntPtr nFontId = pFontFace->GetFontId();
FontList::iterator it = maFontList.find(nFontId);
if( it != maFontList.end() )
pFontInfo = it->second;
FreetypeFontInfo* pFontInfo = it != maFontList.end() ? it->second : nullptr;
if( !pFontInfo )
if (!pFontInfo)
return nullptr;
FreetypeFont* pNew = new FreetypeFont( rFSD, pFontInfo );
return pNew;
return new FreetypeFont(rFSD, pFontInfo);
}
FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const FontAttributes& rDFA )
......
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