summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--vm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/vm.c b/vm.c
index 45e6f42..7d4c10e 100644
--- a/vm.c
+++ b/vm.c
@@ -2602,9 +2602,6 @@ uc_vm_execute_chunk(uc_vm_t *vm)
if (vm->callframes.count <= 1) {
uc_vm_reset_callframes(vm);
- if (vm->exhandler)
- vm->exhandler(vm, &vm->exception);
-
return ERROR_RUNTIME;
}
@@ -2677,6 +2674,9 @@ uc_vm_execute(uc_vm_t *vm, uc_program_t *program, uc_value_t **retval)
break;
default:
+ if (vm->exhandler)
+ vm->exhandler(vm, &vm->exception);
+
if (retval)
*retval = NULL;
@@ -2741,8 +2741,12 @@ uc_vm_invoke(uc_vm_t *vm, const char *fname, size_t nargs, ...)
ex = uc_vm_call(vm, false, nargs);
- if (ex)
+ if (ex) {
+ if (vm->exhandler)
+ vm->exhandler(vm, &vm->exception);
+
return NULL;
+ }
return uc_vm_stack_pop(vm);
}