summaryrefslogtreecommitdiffstats
path: root/libass/ass_font.c
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-10-25 21:19:20 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-10-25 21:19:20 +0000
commit96b63566400632340cd7ebec81686591b633a01e (patch)
treece10c061500dd7056986d53149b2e03af5ad0eb1 /libass/ass_font.c
parenteee843be33e18e678b94ef41588defbeccad8428 (diff)
downloadlibass-96b63566400632340cd7ebec81686591b633a01e.tar.bz2
libass-96b63566400632340cd7ebec81686591b633a01e.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24855 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass/ass_font.c')
-rw-r--r--libass/ass_font.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c
index c434da7..3ae6d71 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -294,12 +294,14 @@ FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch
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