summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-03-01 16:00:49 +0100
committerPatrick Steinhardt <ps@pks.im>2016-03-11 12:14:01 +0100
commit80a834a5af6f8ea70b9f4e8657fa80da124c5693 (patch)
tree3b67a107d78d18fec69dab7c14b8d17530dfb1d1
parent61d7328dc373e80db17fbebe36fb11b32efc047a (diff)
downloadlibgit2-80a834a5af6f8ea70b9f4e8657fa80da124c5693.tar.gz
index: assert required OID are non-NULL
-rw-r--r--src/index.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/index.c b/src/index.c
index b97f8091d..62aacf959 100644
--- a/src/index.c
+++ b/src/index.c
@@ -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;
}