From 18bfd45efb43f6eb0415330ae75cff103e810ff0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 19 Dec 2019 17:37:07 +1100 Subject: [PATCH] Rover: fixed range check for RC channel --- APMrover2/RC_Channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/APMrover2/RC_Channel.h b/APMrover2/RC_Channel.h index 9b7f4aa9e2..d5e30c8159 100644 --- a/APMrover2/RC_Channel.h +++ b/APMrover2/RC_Channel.h @@ -37,7 +37,7 @@ public: RC_Channel_Rover obj_channels[NUM_RC_CHANNELS]; RC_Channel_Rover *channel(const uint8_t chan) override { - if (chan > NUM_RC_CHANNELS) { + if (chan >= NUM_RC_CHANNELS) { return nullptr; } return &obj_channels[chan];