From 5e0ec33b3d9379b78084cd59a9ebed3fc583eed6 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 12 May 2021 14:46:54 -0700 Subject: [PATCH] Error when link width not in [2, 4] --- src/hb-repacker.hh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hb-repacker.hh b/src/hb-repacker.hh index 8d222712d..e553bc622 100644 --- a/src/hb-repacker.hh +++ b/src/hb-repacker.hh @@ -629,26 +629,31 @@ struct graph_t char* head, hb_serialize_context_t* c) const { - if (link.width == 4) + switch (link.width) { + case 4: if (link.is_signed) { serialize_link_of_type (link, head, c); } else { serialize_link_of_type (link, head, c); } - } - else if (link.width == 2) - { + return; + case 2: if (link.is_signed) { serialize_link_of_type (link, head, c); } else { serialize_link_of_type (link, head, c); } - } - else + return; + case 3: serialize_link_of_type (link, head, c); + return; + default: + // Unexpected link width. + assert (0); + } } public: