fix bug in vm_stack

This commit is contained in:
CismonX 2020-06-03 16:07:29 +08:00
parent 7a82c7e3b2
commit 138f9978f8
No known key found for this signature in database
GPG Key ID: 315D6652268C5007
1 changed files with 4 additions and 4 deletions

View File

@ -235,11 +235,11 @@ u6a_vm_stack_xch(struct u6a_vm_var_fn v0) {
return (struct u6a_vm_var_fn) { 0 };
}
if (--prev->refcnt > 0) {
prev = vm_stack_dup(active_stack);
}
if (UNLIKELY(active_stack == NULL)) {
prev = vm_stack_dup(prev);
if (UNLIKELY(prev == NULL)) {
return (struct u6a_vm_var_fn) { 0 };
}
}
if (vs->top == 0) {
++prev->refcnt;
vs->prev = prev;