Skip to content

Commit

Permalink
Restor the state check for update_commit_line (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
lusingander authored Aug 1, 2024
1 parent 46ce2ee commit d125ee0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/graph/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ fn update_commit_line<'a>(
commit_line_state: &mut [Option<&'a CommitHash>],
target_commit_hashes: &[&CommitHash],
) -> usize {
let mut min_pos_x = commit_line_state.len();
if commit_line_state.is_empty() {
return 0;
}
let mut min_pos_x = commit_line_state.len().saturating_sub(1);
for target_hash in target_commit_hashes {
for (pos_x, commit_hash) in commit_line_state.iter().enumerate() {
if let Some(hash) = commit_hash {
Expand Down

0 comments on commit d125ee0

Please sign in to comment.