]> granicus.if.org Git - jq/commitdiff
Allow C-coded functions to `empty`
authorNicolas Williams <nico@cryptonector.com>
Fri, 26 Dec 2014 20:37:38 +0000 (14:37 -0600)
committerNicolas Williams <nico@cryptonector.com>
Sat, 27 Dec 2014 05:05:56 +0000 (23:05 -0600)
Just return a jv_invalid() without a message.

execute.c

index e8fba19d4475c6a7ed6a146f8de8673c512564e9..231bd2189785f347a3e56a4eb1f5eccc291786f6 100644 (file)
--- 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;
     }