From 2dd7b6e57255acf7ecbfbe4ee343ea57502979cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 7 May 2020 00:51:19 +0200 Subject: [PATCH] :bug: Fix vararg in case of null --- src/lib/vararg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/vararg.c b/src/lib/vararg.c index b5128c27..9d357c00 100644 --- a/src/lib/vararg.c +++ b/src/lib/vararg.c @@ -67,8 +67,11 @@ INSTR(VarargIni) { for(m_uint i = 0; i < vector_size(&arg->t); ++i) { const Type t = (Type)vector_at(&arg->t, arg->i); *(m_uint*)(arg->d + offset) = *(m_uint*)(shred->reg - SZ_INT + offset); - if(isa(t, shred->info->vm->gwion->type[et_object]) > 0) - ++(*(M_Object*)(arg->d + offset))->ref; + if(isa(t, shred->info->vm->gwion->type[et_object]) > 0) { + const M_Object obj = *(M_Object*)(arg->d + offset); + if(obj) + ++obj->ref; + } offset += t->size; } arg->s = vector_size(kinds); -- 2.43.0