mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 22:25:04 +00:00
Don't lose our elements when calling git_vector_set()
This commit is contained in:
parent
4c219cf648
commit
4998009a28
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user