From 906d2537b9d0384985ed6259ef77ca1bd3d503ed Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Fri, 26 Dec 2014 14:37:38 -0600 Subject: [PATCH] Allow C-coded functions to `empty` Just return a jv_invalid() without a message. --- execute.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/execute.c b/execute.c index e8fba19d..231bd218 100644 --- a/execute.c +++ b/execute.c @@ -703,9 +703,13 @@ jv jq_next(jq_state *jq) { if (jv_is_valid(top)) { stack_push(jq, top); - } else { + } else if (jv_invalid_has_msg(jv_copy(top))) { set_error(jq, top); goto do_backtrack; + } else { + // C-coded function returns invalid w/o msg? -> backtrack, as if + // it had returned `empty` + goto do_backtrack; } break; }