System/Libraries/Json: Set arr->last_item to NULL if arr->length is zero

This commit is contained in:
Alec Murphy 2025-03-12 09:39:51 -04:00
parent fd8d6ca2b7
commit 8ef544d912

View file

@ -1254,6 +1254,8 @@ U0 @json_remove_item(@json_array* arr, I64 index)
if (next_item) if (next_item)
next_item->prev = prev_item; next_item->prev = prev_item;
@json_remove_item_final : --arr->length; @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) U64 @json_callable_array_index_wrapper_function(I64 index, Bool return_item = FALSE)