Commit 4998009a by Jacques Germishuys

Don't lose our elements when calling git_vector_set()

parent 4c219cf6
......@@ -327,8 +327,10 @@ int git_vector_resize_to(git_vector *v, size_t new_length)
int git_vector_set(void **old, git_vector *v, size_t position, void *value)
{
if (git_vector_resize_to(v, position + 1) < 0)
return -1;
if (position + 1 > v->length) {
if (git_vector_resize_to(v, position + 1) < 0)
return -1;
}
if (old != NULL)
*old = v->contents[position];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment