Rover: fixed range check for RC channel

This commit is contained in:
Andrew Tridgell 2019-12-19 17:37:07 +11:00 committed by Peter Barker
parent 69ea4882d2
commit 18bfd45efb

View File

@ -37,7 +37,7 @@ public:
RC_Channel_Rover obj_channels[NUM_RC_CHANNELS]; RC_Channel_Rover obj_channels[NUM_RC_CHANNELS];
RC_Channel_Rover *channel(const uint8_t chan) override { RC_Channel_Rover *channel(const uint8_t chan) override {
if (chan > NUM_RC_CHANNELS) { if (chan >= NUM_RC_CHANNELS) {
return nullptr; return nullptr;
} }
return &obj_channels[chan]; return &obj_channels[chan];