diff options
author | 2023-02-14 06:40:21 +0100 | |
---|---|---|
committer | 2023-02-14 06:40:21 +0100 | |
commit | efbf66b0a181e4567209e770b859da12ff1c05ad (patch) | |
tree | 4233fa91370a7ff71f6c131ebbebf76daa6b257b /native | |
parent | 2c680a3e5fe8cc3d6cceafe670d71290828018fc (diff) | |
parent | 41822d0dc55a68d3b515e76a6bc6d2accdc611f4 (diff) | |
download | iced-efbf66b0a181e4567209e770b859da12ff1c05ad.tar.gz iced-efbf66b0a181e4567209e770b859da12ff1c05ad.tar.bz2 iced-efbf66b0a181e4567209e770b859da12ff1c05ad.zip |
Merge pull request #1700 from nicksenger/overlay/fix-panic
Fix panic when overlay event processing removes overlay
Diffstat (limited to '')
-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); |