From 8ef544d912e9791de4ddde976dac89a155fe7783 Mon Sep 17 00:00:00 2001 From: Alec Murphy Date: Wed, 12 Mar 2025 09:39:51 -0400 Subject: [PATCH] System/Libraries/Json: Set arr->last_item to NULL if arr->length is zero --- System/Libraries/Json.HC | 2 ++ 1 file changed, 2 insertions(+) diff --git a/System/Libraries/Json.HC b/System/Libraries/Json.HC index b9857b1..83d5c7e 100644 --- a/System/Libraries/Json.HC +++ b/System/Libraries/Json.HC @@ -1254,6 +1254,8 @@ U0 @json_remove_item(@json_array* arr, I64 index) if (next_item) next_item->prev = prev_item; @json_remove_item_final : --arr->length; + if (!arr->length) + arr->last_item = NULL; } U64 @json_callable_array_index_wrapper_function(I64 index, Bool return_item = FALSE)