diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-02-07 11:55:23 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-02-07 11:55:23 +0100 |
commit | 31a577d066f8b56901dc84d2addef97280463ac9 (patch) | |
tree | 74ef47ec49549442392e401178a48632009bcc77 | |
parent | 2e6cbff86e74b6eaa9b90dc8adc205b9d940a481 (diff) | |
download | libgit2-31a577d066f8b56901dc84d2addef97280463ac9.tar.gz |
notes: check error code returned by `git_iterator_advance`
When calling `git_note_next`, we end up calling `git_iterator_advance`
but ignore its error code. The intent is that we do not want to return
an error if it returns `GIT_ITEROVER`, as we want to return that value
on the next invocation of `git_note_next`. We should still check for any
other error codes returned by `git_iterator_advance` to catch unexpected
internal errors.
Fix this by checking the function's return value, ignoring
`GIT_ITEROVER`.
-rw-r--r-- | src/notes.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/notes.c b/src/notes.c index 4633a16ea..68d2ae9ec 100644 --- a/src/notes.c +++ b/src/notes.c @@ -808,8 +808,11 @@ int git_note_next( git_oid_cpy(note_id, &item->id); - if (!(error = process_entry_path(item->path, annotated_id))) - git_iterator_advance(NULL, it); + if ((error = process_entry_path(item->path, annotated_id)) < 0) + return error; - return error; + if ((error = git_iterator_advance(NULL, it)) < 0 && error != GIT_ITEROVER) + return error; + + return 0; } |