Protect against NULL funcs

This commit is contained in:
Behdad Esfahbod 2009-12-20 16:25:18 +01:00
parent 5ceefa1d8d
commit 0465e69832
2 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,9 @@ void
hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
hb_unicode_funcs_t *unicode)
{
if (!unicode)
unicode = &_hb_unicode_funcs_nil;
hb_unicode_funcs_reference (unicode);
hb_unicode_funcs_destroy (buffer->unicode);
buffer->unicode = unicode;

View File

@ -385,6 +385,9 @@ hb_font_set_funcs (hb_font_t *font,
if (font->destroy)
font->destroy (font->user_data);
if (!klass)
klass = &_hb_font_funcs_nil;
hb_font_funcs_reference (klass);
hb_font_funcs_destroy (font->klass);
font->klass = klass;