Fix error handling in strftime

This commit is contained in:
itchyny authored and William Langford committed 2020-05-26 12:29:34 -04:00
1 parent ccc79e592c
commit 15fa1dec99
1 file changed
+4
+4
View File
@@ -1532,6 +1532,10 @@ static jv f_localtime(jq_state *jq, jv a) {
static jv f_strftime(jq_state *jq, jv a, jv b) {
if (jv_get_kind(a) == JV_KIND_NUMBER) {
a = f_gmtime(jq, a);
if (!jv_is_valid(a)) {
jv_free(b);
return a;
}
} else if (jv_get_kind(a) != JV_KIND_ARRAY) {
return ret_error2(a, b, jv_string("strftime/1 requires parsed datetime inputs"));
} else if (jv_get_kind(b) != JV_KIND_STRING) {