From ac4bf86bb65a1e228550cce9314ad17239343c5d Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Tue, 21 May 2024 14:36:07 +0200
Subject: [PATCH] tests: Fix segv in t-json.c

* tests/json/t-json.c (test_contains): Avoid calling recusivly with no
child.
---
 tests/json/t-json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/json/t-json.c b/tests/json/t-json.c
index 0d127a49..4fe74ed7 100644
--- a/tests/json/t-json.c
+++ b/tests/json/t-json.c
@@ -260,7 +260,7 @@ test_contains (cjson_t needle, cjson_t hay)
           fprintf (stderr, "Depth mismatch. Expected child for %s\n",
                    nonnull (needle->string));
         }
-      if (test_contains (needle->child, hay->child))
+      else if (test_contains (needle->child, hay->child))
         {
           int found = 0;
           cjson_t hit;
-- 
2.33.0

