From: Jérémie Astor Date: Fri, 6 Dec 2019 15:15:03 +0000 (+0100) Subject: :art: Check for null tick X-Git-Tag: nightly~2069^2~6 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e53b74c0e2b6bca7de2d58bf15d563f3c074a496;p=gwion.git :art: Check for null tick --- diff --git a/src/lib/modules.c b/src/lib/modules.c index f6e7bee8..48d692a9 100644 --- a/src/lib/modules.c +++ b/src/lib/modules.c @@ -247,13 +247,16 @@ static INSTR(UsrUGenTick) { if(uu->shred) free_vm_shred(uu->shred); UGEN(o)->module.gen.tick = usrugen_tick; + const VM_Code code = *(VM_Code*)(shred->reg-offset); + release(o, shred); + if(!code) + Except(shred, "[NullTickException]"); uu->shred = new_vm_shred(shred->info->vm->gwion->mp, *(VM_Code*)(shred->reg-offset)); ADD_REF(*(VM_Code*)(shred->reg - offset)); uu->shred->info->vm = shred->info->vm; code_prepare(uu->shred->code); shreduler_ini(uu->shred->info->vm->shreduler, uu->shred); uu->prep = instr->m_val ? member_prep : global_prep; - release(o, shred); *(M_Object*)(shred->reg - SZ_INT) = o; } diff --git a/tests/UsrUgen/null_tick.gw b/tests/UsrUgen/null_tick.gw new file mode 100644 index 00000000..6b2d7693 --- /dev/null +++ b/tests/UsrUgen/null_tick.gw @@ -0,0 +1,3 @@ +#! [contains] NullTickException +typedef float ptr_t(float); +ptr_t ptr ~= UsrUGen u;