Commit Diff


commit - a450c2bf919ba378f4246bb2be389f2cade9bcf1
commit + df8cd9c6cd301882ae057c712e2aee94a4b0b195
blob - d776a3f5574a402859f5d57dba32d1813e96a3c5
blob + d2d7bd81d20a0bc7fb36411f186d28e28e4ce1e5
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -513,12 +513,12 @@ got_commit_graph_iter_next(struct got_object_id **id,
 
 	*id = NULL;
 
-	if (TAILQ_EMPTY(&graph->iter_list)) {
+	node = TAILQ_FIRST(&graph->iter_list);
+	if (node == NULL) {
 		/* We are done iterating, or iteration was not started. */
 		return got_error(GOT_ERR_ITER_COMPLETED);
 	}
 
-	node = TAILQ_FIRST(&graph->iter_list);
 	while (TAILQ_NEXT(node, entry) == NULL &&
 	    got_object_idset_num_elements(graph->open_branches) > 0) {
 		err = fetch_commits_from_open_branches(graph, repo,