mirror of
https://github.com/gitui-org/gitui.git
synced 2026-10-12 02:14:16 +00:00
fix potential panic
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ pub const fn calc_scroll_top(
|
||||
height_in_lines: usize,
|
||||
selection: usize,
|
||||
) -> usize {
|
||||
if current_top + height_in_lines <= selection {
|
||||
if current_top.saturating_add(height_in_lines) <= selection {
|
||||
selection.saturating_sub(height_in_lines) + 1
|
||||
} else if current_top > selection {
|
||||
selection
|
||||
|
||||
Reference in New Issue
Block a user