diff --git a/src/core/vm.c b/src/core/vm.c index 6645cfb5..caf51407 100644 --- a/src/core/vm.c +++ b/src/core/vm.c @@ -861,7 +861,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) { vm_pcnext(); VM_OP(JOP_EQUALS_IMMEDIATE) - stack[A] = janet_wrap_boolean(janet_unwrap_number(stack[B]) == (double) CS); + stack[A] = janet_wrap_boolean(janet_checktype(stack[B], JANET_NUMBER) && (janet_unwrap_number(stack[B]) == (double) CS)); vm_pcnext(); VM_OP(JOP_NOT_EQUALS) @@ -869,7 +869,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) { vm_pcnext(); VM_OP(JOP_NOT_EQUALS_IMMEDIATE) - stack[A] = janet_wrap_boolean(janet_unwrap_number(stack[B]) != (double) CS); + stack[A] = janet_wrap_boolean(!janet_checktype(stack[B], JANET_NUMBER) || (janet_unwrap_number(stack[B]) != (double) CS)); vm_pcnext(); VM_OP(JOP_COMPARE)