git: fix nil dereference in corrupt repositories

This commit is contained in:
Ori Bernstein 2023-02-18 18:54:13 +00:00
parent cd5bafe7cb
commit c3ba64f693
2 changed files with 2 additions and 2 deletions

View file

@ -280,7 +280,7 @@ fetchpack(Conn *c)
if(hasheq(&have[i], &Zhash) || oshas(&hadobj, have[i]))
continue;
if((o = readobject(have[i])) == nil)
sysfatal("missing object we should have: %H", have[i]);
sysfatal("missing exected object: %H", have[i]);
if(fmtpkt(c, "have %H", o->hash) == -1)
sysfatal("write: %r");
enqueueparent(&haveq, o);

View file

@ -126,7 +126,7 @@ paint(Hash *head, int nhead, Hash *tail, int ntail, Object ***res, int *nres, in
for(i = 0; i < nhead; i++){
if((o = readobject(head[i])) == nil){
fprint(2, "warning: %H does not point at commit\n", o->hash);
fprint(2, "warning: %H does not point at commit\n", head[i]);
werrstr("read head %H: %r", head[i]);
return -1;
}