From 168c0f320a4b676793a249ea568d430598f7beb0 Mon Sep 17 00:00:00 2001 From: Manohar Paturi Date: Tue, 29 Sep 2026 21:33:38 +0530 Subject: [PATCH] Assert the object type in json_object_array_shrink like every array accessor --- json_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/json_object.c b/json_object.c index 862e53a..69e64dc 100644 --- a/json_object.c +++ b/json_object.c @@ -1834,6 +1834,7 @@ static int json_array_equal(struct json_object *jso1, struct json_object *jso2) int json_object_array_shrink(struct json_object *jso, int empty_slots) { + assert(json_object_get_type(jso) == json_type_array); if (empty_slots < 0) json_abort("json_object_array_shrink called with negative empty_slots"); return array_list_shrink(JC_ARRAY(jso)->c_array, empty_slots);