From f183b57ed53fb24171f3c31c49dde0bea973accc Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Fri, 10 Jul 2015 12:32:11 -0500 Subject: [PATCH] input_filename should never empty --- builtin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builtin.c b/builtin.c index 22dc091..d2e0628 100644 --- 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); -- 2.40.0