diff --git a/bracket-bevy/src/consoles/update_system.rs b/bracket-bevy/src/consoles/update_system.rs index 4faccc8a..1527d842 100644 --- a/bracket-bevy/src/consoles/update_system.rs +++ b/bracket-bevy/src/consoles/update_system.rs @@ -104,9 +104,15 @@ pub(crate) fn update_mouse_position( // Bevy really needs a nicer way to do this let (camera, camera_transform) = q_camera.single(); let wnd = if let RenderTarget::Window(id) = camera.target { - wnds.get(id).unwrap() + wnds.get(id) } else { - wnds.get_primary().unwrap() + wnds.get_primary() + }; + + let wnd = if let Some(wnd) = wnd { + wnd + } else { + return; }; if let Some(screen_pos) = wnd.cursor_position() {