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.

Return an empty measurement instead of panicking (#15269)

Kirill Bulatove830865eb107
diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs
index 76c6b2677b3..4dc2f5335de 100644
--- a/crates/gpui/src/elements/uniform_list.rs
+++ b/crates/gpui/src/elements/uniform_list.rs
@@ -325,7 +325,9 @@ impl UniformList {
let item_ix = cmp::min(self.item_to_measure_index, self.item_count - 1);
let mut items = (self.render_items)(item_ix..item_ix + 1, cx);
- let mut item_to_measure = items.pop().unwrap();
+ let Some(mut item_to_measure) = items.pop() else {
+ return Size::default();
+ };
let available_space = size(
list_width.map_or(AvailableSpace::MinContent, |width| {
AvailableSpace::Definite(width)