Don't lose our elements when calling git_vector_set()

This commit is contained in:
Jacques Germishuys 2014-04-06 15:06:46 +02:00
parent 4c219cf648
commit 4998009a28

View File

@ -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 (position + 1 > v->length) {
if (git_vector_resize_to(v, position + 1) < 0)
return -1;
}
if (old != NULL)
*old = v->contents[position];