Skip to content

Commit 255c1c0

Browse files
committed
More fixes
1 parent 9ca9958 commit 255c1c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/wrapper/repository_wrapper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ size_t repository_wrapper::shallow_depth_from_head() const
325325
commit_list_wrapper parent_list({});
326326
std::vector<size_t> has_parent_list;
327327

328-
for (size_t i = 0; commits_list.size(); i++)
328+
for (size_t i = 0; i < commits_list.size(); i++)
329329
{
330330
const commit_wrapper& commit = commits_list[i];
331331
size_t depth = depth_list[i];
@@ -356,7 +356,8 @@ size_t repository_wrapper::shallow_depth_from_head() const
356356
}
357357
depth_list = temp_depth_list;
358358
commits_list = commit_list_wrapper(std::move(temp_commits_list));
359-
has_parent = *std::max_element(has_parent_list.begin(), has_parent_list.end());
359+
auto has_parent_iter = std::max_element(has_parent_list.begin(), has_parent_list.end());
360+
has_parent = has_parent_iter != has_parent_list.end() ? *has_parent_iter : 0u;
360361
}
361362

362363
depth = *std::max_element(final_depths.begin(), final_depths.end());

0 commit comments

Comments
 (0)