[buffer] Handle null buffer in set_message_func

This commit is contained in:
Behdad Esfahbod 2022-11-23 22:03:26 -07:00
parent 1fa64c0c23
commit 094f80738a
1 changed files with 7 additions and 0 deletions

View File

@ -2150,6 +2150,13 @@ hb_buffer_set_message_func (hb_buffer_t *buffer,
hb_buffer_message_func_t func, hb_buffer_message_func_t func,
void *user_data, hb_destroy_func_t destroy) void *user_data, hb_destroy_func_t destroy)
{ {
if (unlikely (hb_object_is_immutable (buffer)))
{
if (destroy)
destroy (user_data);
return;
}
if (buffer->message_destroy) if (buffer->message_destroy)
buffer->message_destroy (buffer->message_data); buffer->message_destroy (buffer->message_data);