summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2014-12-26 14:37:38 -0600
committerNicolas Williams <nico@cryptonector.com>2014-12-26 23:05:56 -0600
commit906d2537b9d0384985ed6259ef77ca1bd3d503ed (patch)
tree9fff6cbc7e390ae48a52cfb102cbe17de7b7e9b6
parentbbb287f54bbea23e37b44c5938e423d485c4fe8b (diff)
Allow C-coded functions to `empty`
Just return a jv_invalid() without a message.
-rw-r--r--execute.c6
1 files changed, 5 insertions, 1 deletions
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;
}