From 68b1e5898be9fba875d9c29eb3289da33d8e7855 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 28 Apr 2023 09:58:54 +0200 Subject: [PATCH] :bug: fix enum gack --- src/lib/enum.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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) { -- 2.43.0