From: Dmitry Volyntsev Date: Tue, 26 Mar 2019 12:28:18 +0000 (+0300) Subject: Treating null and undefined as empty string for external prop set. X-Git-Tag: 0.3.0~3 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=6677924a7882bd296576731728c1891d15657229;p=njs.git Treating null and undefined as empty string for external prop set. --- diff --git a/njs/njs_object.c b/njs/njs_object.c index cf7b0944..a6277956 100644 --- a/njs/njs_object.c +++ b/njs/njs_object.c @@ -684,9 +684,14 @@ njs_external_property_set(njs_vm_t *vm, njs_value_t *value, njs_value_t *setval, pq = (njs_property_query_t *) vm->stash; - ret = njs_vm_value_to_ext_string(vm, &s, setval, 0); - if (nxt_slow_path(ret != NXT_OK)) { - return ret; + if (!njs_is_null_or_undefined(setval)) { + ret = njs_vm_value_to_ext_string(vm, &s, setval, 0); + if (nxt_slow_path(ret != NXT_OK)) { + return ret; + } + + } else { + s = nxt_string_value(""); } *retval = *setval;