From: fennecdjay Date: Fri, 28 Apr 2023 07:58:54 +0000 (+0200) Subject: :bug: fix enum gack X-Git-Tag: nightly~166 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=68b1e5898be9fba875d9c29eb3289da33d8e7855;p=gwion.git :bug: fix enum gack --- diff --git a/src/lib/enum.c b/src/lib/enum.c index dda25b0d..fd1a8383 100644 --- a/src/lib/enum.c +++ b/src/lib/enum.c @@ -13,11 +13,14 @@ static GACK(gack_enum) { 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); + for(m_uint i = 0; i < map_size(m); i++) { + const Value v = (Value)map_at(&t->nspc->info->value->map, i); + if((m_uint)v->d.ptr == value) { + INTERP_PRINTF("%s", v->name); + return; + } + } + INTERP_PRINTF("%s", t->name); } GWION_IMPORT(enum) {