make OxrEvent less unsound

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-11-30 01:16:17 +01:00
parent 5239700eca
commit bc0c1c472b
4 changed files with 22 additions and 14 deletions

View File

@@ -26,7 +26,8 @@ impl Plugin for OxrOverlayPlugin {
}
fn handle_overlay_event(event: In<OxrEvent>, mut writer: EventWriter<OxrOverlaySessionEvent>) {
if let Event::MainSessionVisibilityChangedEXTX(event) = unsafe { event.get() } {
// this unwrap will never panic since we are in a valid scope
if let Event::MainSessionVisibilityChangedEXTX(event) = unsafe { event.get() }.unwrap() {
writer.send(OxrOverlaySessionEvent::MainSessionVisibilityChanged {
visible: event.visible(),
flags: event.flags(),