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