Skip to content

Commit 73d7469

Browse files
Ralph Kuepperclaude
andcommitted
fix: guard against unwrap panic in layout and more try_borrow fixes
- layout_stack: replace unwrap() on get_widget_info with graceful fallback - handle_scroll: use try_borrow for widget kind lookup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bfc90d9 commit 73d7469

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

crates/perry-ui-windows/src/layout.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ fn layout_stack(handle: i64, width: i32, height: i32, vertical: bool) {
100100
let mut child_sizes: Vec<i32> = Vec::new();
101101

102102
for &child in &visible_children {
103-
let ci = widgets::get_widget_info(child).unwrap();
103+
let ci = match widgets::get_widget_info(child) {
104+
Some(ci) => ci,
105+
None => { child_sizes.push(0); continue; }
106+
};
104107
if matches!(ci.kind, WidgetKind::Spacer) || ci.fills_remaining {
105108
child_sizes.push(0); // placeholder, will be computed below
106109
} else if !vertical && ci.fixed_width.is_some() {

0 commit comments

Comments
 (0)