From 34ccc19bce606a9bebd89043bed0e18f1a7eb5ac Mon Sep 17 00:00:00 2001 From: Shute052 Date: Wed, 31 Jan 2024 05:16:08 +0800 Subject: [PATCH] Fix get `None` --- src/input_map.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/input_map.rs b/src/input_map.rs index 508f4e6e..4d8dd4e7 100644 --- a/src/input_map.rs +++ b/src/input_map.rs @@ -326,9 +326,10 @@ impl InputMap { let mut action_datum = ActionData::default(); for input in input_vec { - action_datum.axis_pair = input_streams.input_axis_pair(input).map(|new_data| { - new_data.merged_with(action_datum.axis_pair.unwrap_or_default()) - }); + if let Some(new_data) = input_streams.input_axis_pair(input) { + let current_data = action_datum.axis_pair.unwrap_or_default(); + action_datum.axis_pair = Some(new_data.merged_with(current_data)); + } if input_streams.input_pressed(input) { action_datum.state = ButtonState::JustPressed;