[serialize] Don't insert empty object into tree
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 31 Mar 2019 02:26:37 +0000 (19:26 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 31 Mar 2019 02:26:37 +0000 (19:26 -0700)
src/hb-serialize.hh

index e7873ab..3bbff75 100644 (file)
@@ -160,6 +160,9 @@ struct hb_serialize_context_t
     memmove (tail, obj.head, len);
     head = obj.head;
 
+    if (!len)
+      return 0;
+
     obj.head = tail;
     obj.tail = tail + len;
 
@@ -304,7 +307,7 @@ struct hb_serialize_context_t
   hb_vector_t<object_t> packed;
 
   /* Map view of packed objects. */
-  hb_hashmap_t<const object_t *, objidx_t> packed_map;
+  hb_hashmap_t<const object_t *, objidx_t, nullptr, 0> packed_map;
 };