From: fennecdjay Date: Sun, 3 Jul 2022 16:07:25 +0000 (+0200) Subject: :bug: Fix enum pp X-Git-Tag: nightly~264^2~116 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=ee1147ecfacd8ec56acc65bfe029ef646cf547e9;p=gwion.git :bug: Fix enum pp --- diff --git a/src/parse/scan0.c b/src/parse/scan0.c index ade9f79e..ded15e62 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -211,8 +211,13 @@ ANN m_bool scan0_type_def(const Env env, const Type_Def tdef) { #include "gack.h" static GACK(gack_enum) { - const Value v = (Value)map_at(&t->nspc->info->value->map, *(m_uint*)VALUE); - INTERP_PRINTF("%s", v->name); + const Map m = &t->nspc->info->value->map; + const m_uint value = *(m_uint*)VALUE; + if(value < map_size(m)) { + const Value v = (Value)map_at(&t->nspc->info->value->map, *(m_uint*)VALUE); + INTERP_PRINTF("%s", v->name); + } else + INTERP_PRINTF("%s", t->name); } ANN static Type enum_type(const Env env, const Enum_Def edef) {