File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,16 @@ int parse_commit(struct commit *item)
59
59
sha1_to_hex (item -> object .sha1 ));
60
60
get_sha1_hex (bufptr + 5 , parent );
61
61
item -> tree = lookup_tree (parent );
62
- add_ref (& item -> object , & item -> tree -> object );
62
+ if (item -> tree )
63
+ add_ref (& item -> object , & item -> tree -> object );
63
64
bufptr += 46 ; /* "tree " + "hex sha1" + "\n" */
64
65
while (!memcmp (bufptr , "parent " , 7 ) &&
65
66
!get_sha1_hex (bufptr + 7 , parent )) {
66
67
struct commit * new_parent = lookup_commit (parent );
67
- commit_list_insert (new_parent , & item -> parents );
68
- add_ref (& item -> object , & new_parent -> object );
68
+ if (new_parent ) {
69
+ commit_list_insert (new_parent , & item -> parents );
70
+ add_ref (& item -> object , & new_parent -> object );
71
+ }
69
72
bufptr += 48 ;
70
73
}
71
74
item -> date = parse_commit_date (bufptr );
Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ int parse_tree(struct tree *item)
137
137
entry -> item .blob = lookup_blob (file_sha1 );
138
138
obj = & entry -> item .blob -> object ;
139
139
}
140
- add_ref (& item -> object , obj );
140
+ if (obj )
141
+ add_ref (& item -> object , obj );
141
142
142
143
* list_p = entry ;
143
144
list_p = & entry -> next ;
You can’t perform that action at this time.
0 commit comments