diff --git a/src/hb-buffer.c b/src/hb-buffer.c index 9d4d5180a..4dd18ed88 100644 --- a/src/hb-buffer.c +++ b/src/hb-buffer.c @@ -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; diff --git a/src/hb-font.cc b/src/hb-font.cc index 1cffc91cd..b284477e4 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -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;