Address out-of-bounds panic in inline completion button (#26394)

Closes #26350

Release Notes:

- Git Beta: Fixed a panic that could occur when using the project diff
This commit is contained in:
Cole Miller
2025-03-11 03:04:56 -04:00
committed by GitHub
parent 9bd3e156f5
commit 0df1e4a489
2 changed files with 19 additions and 2 deletions
@@ -3378,6 +3378,17 @@ fn assert_position_translation(snapshot: &MultiBufferSnapshot) {
}
}
}
let point = snapshot.max_point();
let Some((buffer, offset)) = snapshot.point_to_buffer_offset(point) else {
return;
};
assert!(offset <= buffer.len(),);
let Some((buffer, point, _)) = snapshot.point_to_buffer_point(point) else {
return;
};
assert!(point <= buffer.max_point(),);
}
fn assert_line_indents(snapshot: &MultiBufferSnapshot) {