tests: Fix segv in t-json.c

* tests/json/t-json.c (test_contains): Avoid calling recusivly with no
child.
This commit is contained in:
Werner Koch 2024-05-21 14:36:07 +02:00
parent 55a1ae4163
commit ac4bf86bb6
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -260,7 +260,7 @@ test_contains (cjson_t needle, cjson_t hay)
fprintf (stderr, "Depth mismatch. Expected child for %s\n", fprintf (stderr, "Depth mismatch. Expected child for %s\n",
nonnull (needle->string)); nonnull (needle->string));
} }
if (test_contains (needle->child, hay->child)) else if (test_contains (needle->child, hay->child))
{ {
int found = 0; int found = 0;
cjson_t hit; cjson_t hit;