We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de6da50 commit f3df454Copy full SHA for f3df454
1 file changed
src/cortex-tui/src/interactive/renderer.rs
@@ -109,7 +109,13 @@ impl<'a> InteractiveWidget<'a> {
109
let hints_height = 1;
110
let border_height = 2;
111
112
- (items_count as u16) + header_height + search_height + hints_height + border_height
+ // Use saturating conversion to prevent overflow when items_count exceeds u16::MAX
113
+ let items_height = u16::try_from(items_count).unwrap_or(u16::MAX);
114
+ items_height
115
+ .saturating_add(header_height)
116
+ .saturating_add(search_height)
117
+ .saturating_add(hints_height)
118
+ .saturating_add(border_height)
119
}
120
121
0 commit comments