Mercurial > mplayer.hg
changeset 24827:4ec67a66ef54
Check return value of add_face.
This fixes segfault when reselecting fonts and the new font could not be
loaded (because of a bad font file, or too many font faces already loaded).
Patch by Glen Nakamura, glen at imodulo dot com.
author | eugeni |
---|---|
date | Thu, 25 Oct 2007 21:19:20 +0000 |
parents | ac881f93b661 |
children | 810982c2bfb4 |
files | libass/ass_font.c |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libass/ass_font.c Thu Oct 25 19:21:24 2007 +0000 +++ b/libass/ass_font.c Thu Oct 25 21:19:20 2007 +0000 @@ -294,12 +294,14 @@ mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_GlyphNotFoundReselectingFont, ch, font->desc.family, font->desc.bold, font->desc.italic); face_idx = add_face(fontconfig_priv, font, ch); + if (face_idx >= 0) { face = font->faces[face_idx]; index = FT_Get_Char_Index(face, ch); if (index == 0) { mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_GlyphNotFound, ch, font->desc.family, font->desc.bold, font->desc.italic); } + } } #endif