diff options
author | 2023-02-11 09:11:00 -0800 | |
---|---|---|
committer | 2023-02-11 09:12:26 -0800 | |
commit | 41822d0dc55a68d3b515e76a6bc6d2accdc611f4 (patch) | |
tree | 8f1d78d1f32897779848702500b7e60b2d29c66f /native/src/user_interface.rs | |
parent | 92ba26b8a168b1d58b8330d84753c5ab7e116f17 (diff) | |
download | iced-41822d0dc55a68d3b515e76a6bc6d2accdc611f4.tar.gz iced-41822d0dc55a68d3b515e76a6bc6d2accdc611f4.tar.bz2 iced-41822d0dc55a68d3b515e76a6bc6d2accdc611f4.zip |
fix: panic when overlay event processing removes overlay
Diffstat (limited to 'native/src/user_interface.rs')
-rw-r--r-- | native/src/user_interface.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 80dece21..2358bff1 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -263,16 +263,16 @@ where } } - let base_cursor = if manual_overlay + let base_cursor = manual_overlay .as_ref() - .unwrap() - .is_over(Layout::new(&layout), cursor_position) - { - // TODO: Type-safe cursor availability - Point::new(-1.0, -1.0) - } else { - cursor_position - }; + .filter(|overlay| { + overlay.is_over(Layout::new(&layout), cursor_position) + }) + .map(|_| { + // TODO: Type-safe cursor availability + Point::new(-1.0, -1.0) + }) + .unwrap_or(cursor_position); self.overlay = Some(layout); |