From 4a6b335f7df04599cbea488f40848c96dc2e7541 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 7 Sep 2024 18:35:16 +0200 Subject: [PATCH] Do not send uninitialized HID event If the function returns false, then there is nothing to send. --- app/src/uhid/keyboard_uhid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/uhid/keyboard_uhid.c b/app/src/uhid/keyboard_uhid.c index 515a3fd9..4199547a 100644 --- a/app/src/uhid/keyboard_uhid.c +++ b/app/src/uhid/keyboard_uhid.c @@ -43,7 +43,9 @@ sc_keyboard_uhid_synchronize_mod(struct sc_keyboard_uhid *kb) { atomic_store_explicit(&kb->device_mod, mod, memory_order_relaxed); struct sc_hid_event hid_event; - sc_hid_keyboard_event_from_mods(&hid_event, diff); + if (!sc_hid_keyboard_event_from_mods(&hid_event, diff)) { + return; + } LOGV("HID keyboard state synchronized");