Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix overflow in `UniformList`

Marshall Bowerse9650c025fe4
diff --git a/crates/gpui2/src/elements/uniform_list.rs b/crates/gpui2/src/elements/uniform_list.rs
index 64933951f5e..d43c6b59926 100644
--- a/crates/gpui2/src/elements/uniform_list.rs
+++ b/crates/gpui2/src/elements/uniform_list.rs
@@ -141,8 +141,11 @@ impl<V: 'static> Element<V> for UniformList<V> {
scroll_offset: element_state.track_scroll_offset(),
});
}
- let visible_item_count =
- (padded_bounds.size.height / item_height).ceil() as usize + 1;
+ let visible_item_count = if item_height > px(0.) {
+ (padded_bounds.size.height / item_height).ceil() as usize + 1
+ } else {
+ 0
+ };
let scroll_offset = element_state
.scroll_offset()
.map_or((0.0).into(), |offset| offset.y);