]> granicus.if.org Git - jq/commitdiff
input_filename should never empty
authorNicolas Williams <nico@cryptonector.com>
Fri, 10 Jul 2015 17:32:11 +0000 (12:32 -0500)
committerNicolas Williams <nico@cryptonector.com>
Fri, 10 Jul 2015 17:32:11 +0000 (12:32 -0500)
builtin.c

index 22dc0914d8486cea9c5e304142fc5f78ff0049d4..d2e0628b9c589599511e35fc77287eb6479be6cf 100644 (file)
--- a/builtin.c
+++ b/builtin.c
@@ -1221,7 +1221,11 @@ static jv f_now(jq_state *jq, jv a) {
 #endif
 
 static jv f_current_filename(jq_state *jq) {
-  return jq_util_input_get_current_filename(jq);
+  jv r = jq_util_input_get_current_filename(jq);
+  if (jv_is_valid(r))
+    return r;
+  jv_free(r);
+  return jv_null();
 }
 static jv f_current_line(jq_state *jq) {
   return jq_util_input_get_current_line(jq);