Merge pull request #1700 from nicksenger/overlay/fix-panic

Fix panic when overlay event processing removes overlay
This commit is contained in:
Héctor Ramón 2023-02-14 06:40:21 +01:00 committed by GitHub
commit efbf66b0a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);