Fix null pointer dereference in status.ByIndex #628
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix-status-nullptr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
git_status_byindex
can return a null pointer if there is no statuses.nice, thanks! just some small requests.
welp, unfortunately there's no consistency with what these functions return :(
Blame.HunkByIndex
:462ebd83e0/blame.go (L102)
Index.EntryByIndex
:462ebd83e0/index.go (L420)
Tree.EntryByIndex
: Does nothing and may also need to be fixed (although since it returns a pointer, presumably it could returnnil
when that is fixed).But in this case, since libgit2 does not set an error itself, using
MakeGitError()
will callgiterr_last()
, which will most likely returnGIT_OK
, which will cause this error to have an empty message.so I think the more correct solution here is to do the same thing as
Index.EntryByIndex
:nit:
this is a bit more idiomatic.
nit:
if this fails, then the preconditions for the rest of the test case are not met, which will make the rest of the assertions fail, causing log spam.
This was probably me looking for a
DefaultStatusOptions
and not finding it then not going back and fixing it