Skip to content

Commit 9fd5fdd

Browse files
HarryCuttsAndroid (Google) Code Review
authored andcommitted
Merge "InputVerifier: add panic message for source conversion" into main
2 parents d70cc2a + fa83e33 commit 9fd5fdd

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

libs/input/rust/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ fn process_movement(
133133
flags: u32,
134134
button_state: u32,
135135
) -> String {
136+
let Some(converted_source) = Source::from_bits(source) else {
137+
panic!(
138+
"The conversion of source 0x{source:08x} failed, please check if some sources have not \
139+
been added to Source."
140+
);
141+
};
136142
let Some(motion_flags) = MotionFlags::from_bits(flags) else {
137143
panic!(
138144
"The conversion of flags 0x{:08x} failed, please check if some flags have not been \
@@ -167,7 +173,7 @@ fn process_movement(
167173
}
168174
let result = verifier.process_movement(NotifyMotionArgs {
169175
device_id: DeviceId(device_id),
170-
source: Source::from_bits(source).unwrap(),
176+
source: converted_source,
171177
action: motion_action,
172178
pointer_properties,
173179
flags: motion_flags,

0 commit comments

Comments
 (0)