mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Initialise jq_state->debug_cb{,_data} to NULL
To make debug/0 not call an uninitialised function pointer when using --run-tests or when using a jq_state on which jq_set_debug_cb() has not been called.
This commit is contained in:
committed by
Nico Williams
parent
9e4c71558a
commit
bb0f898c01
@@ -1015,6 +1015,9 @@ jq_state *jq_init(void) {
|
||||
jq->input_cb = NULL;
|
||||
jq->input_cb_data = NULL;
|
||||
|
||||
jq->debug_cb = NULL;
|
||||
jq->debug_cb_data = NULL;
|
||||
|
||||
jq->err_cb = default_err_cb;
|
||||
jq->err_cb_data = stderr;
|
||||
|
||||
|
@@ -1820,8 +1820,12 @@ tojson | fromjson
|
||||
{"a":null}
|
||||
|
||||
|
||||
# calling input/1 in a test doesn't crash jq
|
||||
# calling input/0, or debug/0 in a test doesn't crash jq
|
||||
|
||||
try input catch .
|
||||
null
|
||||
"break"
|
||||
|
||||
debug
|
||||
1
|
||||
1
|
||||
|
Reference in New Issue
Block a user