From e42b82c828ecec6f534040dae5518e04643b5f10 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Apr 2019 17:21:54 -0700 Subject: [PATCH] [serialize] Handle non-nullable offsets --- src/hb-open-type.hh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index b210b29..410a5f1 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -281,19 +281,24 @@ struct OffsetTo : Offset } template - void serialize_subset (hb_subset_context_t *c, const T &src, const void *base) + bool serialize_subset (hb_subset_context_t *c, const T &src, const void *base) { *this = 0; - if (&src == &Null (T)) - return; + if (has_null && &src == &Null (T)) + return false; c->serializer->push (); - if (src.subset (c)) + + bool ret = src.subset (c); + + if (ret || !has_null) c->serializer->add_link (*this, c->serializer->pop_pack (), base); else c->serializer->pop_discard (); + + return ret; } bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const -- 2.7.4