]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Fix vararg in case of null
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Wed, 6 May 2020 22:51:19 +0000 (00:51 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Wed, 6 May 2020 22:51:19 +0000 (00:51 +0200)
src/lib/vararg.c

index b5128c273c6b80959273b4233b70456283379335..9d357c00ecfb22a4cbcf87dd4dcdc75c2b01daca 100644 (file)
@@ -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);