[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara
caolanm at redhat.com
Fri May 11 20:02:16 UTC 2018
vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
New commits:
commit 9e11fb7c464a0ede7686023ccec1761e527d0f81
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 11 15:30:18 2018 +0100
coverity#1435548 rework to avoid Dereference after null check warning
Change-Id: Ifb0d6af999e4935009669a7f85a77e640ce0eddc
Reviewed-on: https://gerrit.libreoffice.org/54138
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index b2b1c59f67cf..6476950e5fe5 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -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 )
More information about the Libreoffice-commits
mailing list