Commit Diff


commit - c0cca3f632d5afe2711669d320c2aa4809ea4abd
commit + ac4e69fbc9b15eb4f36baa8a21c92ba3afe81cc8
blob - 1bd427826701c298c82bdf7f6c5770747fa61b82
blob + ae64f9afe555ae449ffadfb4d39015675ba0b35b
--- lib/object_idset.c
+++ lib/object_idset.c
@@ -165,18 +165,13 @@ got_object_idset_remove(struct got_object_idset *set,
     struct got_object_id *id)
 {
 	struct got_object_idset_element *entry, *tmp;
-	uint8_t i;
+	uint8_t i = id->sha1[0];
 
-	if (id)
-		i = id->sha1[0];
-	else
-		i = arc4random_uniform(nitems(set->entries));
-
 	if (set->nelem == 0)
 		return got_error(GOT_ERR_NO_OBJ);
 
 	TAILQ_FOREACH_SAFE(entry, &set->entries[i], entry, tmp) {
-		if (id == NULL || got_object_id_cmp(&entry->id, id) == 0) {
+		if (got_object_id_cmp(&entry->id, id) == 0) {
 			TAILQ_REMOVE(&set->entries[i], entry, entry);
 			set->nelem--;
 			return NULL;