From e114bbac892566102e111e34dc6f44d4920bb655 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 1 Mar 2016 16:00:49 +0100 Subject: [PATCH] index: assert required OID are non-NULL --- src/index.c | 12 +++++++++--- 1 file 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; }