[vlc-devel] [PATCH] freetype/platform_fonts: Do not strdup NULL

Marvin Scholz epirat07 at gmail.com
Sat Jun 17 14:05:33 CEST 2017


---
 modules/text_renderer/freetype/platform_fonts.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/text_renderer/freetype/platform_fonts.c b/modules/text_renderer/freetype/platform_fonts.c
index 4491f6dce5..2e6bfa431d 100644
--- a/modules/text_renderer/freetype/platform_fonts.c
+++ b/modules/text_renderer/freetype/platform_fonts.c
@@ -572,8 +572,10 @@ char* Generic_Select( filter_t *p_filter, const char* psz_family,
     if( p_family && ( p_font = GetBestFont( p_filter, p_family, b_bold,
                                             b_italic, codepoint ) ) )
     {
-        *i_idx = p_font->i_index;
-        return strdup( p_font->psz_fontfile );
+        if (p_font->psz_fontfile) {
+            *i_idx = p_font->i_index;
+            return strdup( p_font->psz_fontfile );
+        }
     }
 
     return File_Select( SYSTEM_DEFAULT_FONT_FILE );
-- 
2.11.0 (Apple Git-81)



More information about the vlc-devel mailing list