diff options
-rw-r--r-- | types.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -699,13 +699,18 @@ bool ucv_array_set(uc_value_t *uv, size_t index, uc_value_t *item) { uc_array_t *array = (uc_array_t *)uv; + size_t old_count; if (ucv_type(uv) != UC_ARRAY) return false; if (index >= array->count) { + old_count = array->count; array->count = index + 1; uc_vector_grow(array); + + while (old_count < array->count) + array->entries[old_count++] = NULL; } else { ucv_put(array->entries[index]); |