From: Adeel Kazmi Date: Wed, 6 Mar 2019 11:58:30 +0000 (+0000) Subject: Ensure FreeType library calls are successful before we continue processing X-Git-Tag: dali_1.4.10~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F200961%2F2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Ensure FreeType library calls are successful before we continue processing Change-Id: I69ddfdcbcbabf555627583b43de23cd393b25243 --- diff --git a/dali/internal/text/text-abstraction/cairo-renderer.cpp b/dali/internal/text/text-abstraction/cairo-renderer.cpp index ea3a013..d65e1dd 100755 --- a/dali/internal/text/text-abstraction/cairo-renderer.cpp +++ b/dali/internal/text/text-abstraction/cairo-renderer.cpp @@ -261,7 +261,12 @@ Devel::PixelBuffer RenderTextCairo( const TextAbstraction::TextRenderer::Paramet Dali::TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient::Get(); FT_Library ftLibrary; - FT_Init_FreeType(&ftLibrary); + auto error = FT_Init_FreeType(&ftLibrary); + if( error ) + { + DALI_LOG_ERROR( "Error initializing FT library\n" ); + return CreateVoidPixelBuffer( parameters ); + } // Vector used to store the FreeType font faces, its size and the run of glyphs that use the font. std::vector glyphRuns; @@ -325,7 +330,12 @@ Devel::PixelBuffer RenderTextCairo( const TextAbstraction::TextRenderer::Paramet case FontDescription::FACE_FONT: { // Create a FreeType font's face. - FT_New_Face(ftLibrary, fontDescription.path.c_str(), 0u, ¤tGlyphRun.fontFace); + error = FT_New_Face( ftLibrary, fontDescription.path.c_str(), 0u, ¤tGlyphRun.fontFace ); + if( error ) + { + DALI_LOG_ERROR( "Error in FT while creating new face\n" ); + return CreateVoidPixelBuffer( parameters ); + } // Set the font's size. It needs to be set in the Freetype font and in the Cairo's context. unsigned int fontSize = fontClient.GetPointSize( fontId );