]> granicus.if.org Git - jq/commitdiff
Don't force C API users to set input cb
authorNicolas Williams <nico@cryptonector.com>
Sat, 27 Dec 2014 22:51:39 +0000 (16:51 -0600)
committerNicolas Williams <nico@cryptonector.com>
Sun, 28 Dec 2014 00:15:10 +0000 (18:15 -0600)
builtin.c

index 9a5660a709ad7d524f37670e1bd448b7ce079f73..0bf7b9f05189e5e3129023acbe43a6d88a1af5ac 100644 (file)
--- a/builtin.c
+++ b/builtin.c
@@ -867,6 +867,8 @@ static jv f_input(jq_state *jq, jv input) {
   jq_input_cb cb;
   void *data;
   jq_get_input_cb(jq, &cb, &data);
+  if (cb == NULL)
+    return jv_invalid_with_msg(jv_string("break"));
   jv v = cb(jq, data);
   if (jv_is_valid(v) || jv_invalid_has_msg(jv_copy(v)))
     return v;