]> git.kaiwu.me - njs.git/commitdiff
Fixed njs_vmcode_restart().
authorhongzhidao <hongzhidao@gmail.com>
Thu, 25 Apr 2019 12:56:44 +0000 (15:56 +0300)
committerhongzhidao <hongzhidao@gmail.com>
Thu, 25 Apr 2019 12:56:44 +0000 (15:56 +0300)
njs/njs_vm.c

index da776fdaedad749f65550d940c6507735455c6b8..536698546a1877442e9a77fc4db909ed8e23fb20 100644 (file)
@@ -2852,17 +2852,21 @@ njs_vmcode_restart(njs_vm_t *vm, njs_value_t *invld1, njs_value_t *invld2)
 
     ret = vmcode->code.operation(vm, value1, &frame->trap_values[1]);
 
+    if (nxt_slow_path(ret == NJS_ERROR)) {
+        return ret;
+    }
+
     if (nxt_slow_path(ret == NJS_TRAP)) {
         /* Trap handlers are not reentrant. */
         njs_internal_error(vm, "trap inside restart instruction");
         return NXT_ERROR;
     }
 
-    retval = njs_vmcode_operand(vm, vmcode->operand1);
-
-    njs_release(vm, retval);
-
-    *retval = vm->retval;
+    if (vmcode->code.retval) {
+        retval = njs_vmcode_operand(vm, vmcode->operand1);
+        njs_release(vm, retval);
+        *retval = vm->retval;
+    }
 
     return ret;
 }