index: assert required OID are non-NULL

This commit is contained in:
Patrick Steinhardt 2016-03-01 16:00:49 +01:00 committed by Edward Thomson
parent d0780b8133
commit e114bbac89

View File

@ -963,14 +963,20 @@ static int index_entry_reuc_init(git_index_reuc_entry **reuc_out,
*reuc_out = reuc = reuc_entry_alloc(path);
GITERR_CHECK_ALLOC(reuc);
if ((reuc->mode[0] = ancestor_mode) > 0)
if ((reuc->mode[0] = ancestor_mode) > 0) {
assert(ancestor_oid);
git_oid_cpy(&reuc->oid[0], ancestor_oid);
}
if ((reuc->mode[1] = our_mode) > 0)
if ((reuc->mode[1] = our_mode) > 0) {
assert(our_oid);
git_oid_cpy(&reuc->oid[1], our_oid);
}
if ((reuc->mode[2] = their_mode) > 0)
if ((reuc->mode[2] = their_mode) > 0) {
assert(their_oid);
git_oid_cpy(&reuc->oid[2], their_oid);
}
return 0;
}