Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 80a834a

Browse files
committed
index: assert required OID are non-NULL
1 parent 61d7328 commit 80a834a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/index.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,14 +963,20 @@ static int index_entry_reuc_init(git_index_reuc_entry **reuc_out,
963963
*reuc_out = reuc = reuc_entry_alloc(path);
964964
GITERR_CHECK_ALLOC(reuc);
965965

966-
if ((reuc->mode[0] = ancestor_mode) > 0)
966+
if ((reuc->mode[0] = ancestor_mode) > 0) {
967+
assert(ancestor_oid);
967968
git_oid_cpy(&reuc->oid[0], ancestor_oid);
969+
}
968970

969-
if ((reuc->mode[1] = our_mode) > 0)
971+
if ((reuc->mode[1] = our_mode) > 0) {
972+
assert(our_oid);
970973
git_oid_cpy(&reuc->oid[1], our_oid);
974+
}
971975

972-
if ((reuc->mode[2] = their_mode) > 0)
976+
if ((reuc->mode[2] = their_mode) > 0) {
977+
assert(their_oid);
973978
git_oid_cpy(&reuc->oid[2], their_oid);
979+
}
974980

975981
return 0;
976982
}

0 commit comments

Comments
 (0)