From 5f32648b21f77d89ef36673a581fb6908039056b Mon Sep 17 00:00:00 2001 From: philmoz Date: Wed, 6 Mar 2024 11:31:04 +1100 Subject: [PATCH] fix(radio): invalid memory access if SpaceMouse input present but not supported (#4686) i.e. somehow the input has been specified but not has not been specified as a option in the firmware --- radio/src/mixer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 6081da5b5..cbe00ffc8 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -360,9 +360,13 @@ getvalue_t getValue(mixsrc_t i, bool* valid) } #endif -#if defined(SPACEMOUSE) +#if defined(PCBHORUS) else if (i >= MIXSRC_FIRST_SPACEMOUSE && i <= MIXSRC_LAST_SPACEMOUSE) { +#if defined(SPACEMOUSE) return get_spacemouse_value(i - MIXSRC_FIRST_SPACEMOUSE); +#else + return 0; +#endif } #endif