# HG changeset patch # User eugeni # Date 1193347160 0 # Node ID 4ec67a66ef5422f31763052b08e48615b15b5f21 # Parent ac881f93b66152e2b1cb7d116af374aee2125449 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. diff -r ac881f93b661 -r 4ec67a66ef54 libass/ass_font.c --- 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