mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
HAL_ChibiOS: fixed handling of invalid channel for LED write
this prevents a null ptr dereference when an invalid channel (such as one on IOMCU) is used for LEDs
This commit is contained in:
parent
098a17fe2e
commit
0cc4409845
@ -1979,12 +1979,12 @@ void RCOutput::set_serial_led_rgb_data(const uint16_t chan, int8_t led, uint8_t
|
|||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
pwm_group *grp = find_chan(chan, i);
|
pwm_group *grp = find_chan(chan, i);
|
||||||
|
|
||||||
WITH_SEMAPHORE(grp->serial_led_mutex);
|
|
||||||
|
|
||||||
if (!grp || grp->serial_nleds == 0) {
|
if (!grp || grp->serial_nleds == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WITH_SEMAPHORE(grp->serial_led_mutex);
|
||||||
|
|
||||||
if (led == -1) {
|
if (led == -1) {
|
||||||
grp->prepared_send = true;
|
grp->prepared_send = true;
|
||||||
for (uint8_t n=0; n<grp->serial_nleds; n++) {
|
for (uint8_t n=0; n<grp->serial_nleds; n++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user