Copter: add sanity check when fetching GCS_MAVLink instance

This commit is contained in:
Peter Barker 2019-06-25 12:57:45 +10:00 committed by Andrew Tridgell
parent 77187cd7e2
commit fab17ba3bf
1 changed files with 12 additions and 4 deletions

View File

@ -13,12 +13,20 @@ public:
uint8_t num_gcs() const override { return ARRAY_SIZE(_chan); };
// return GCS link at offset ofs
GCS_MAVLINK_Copter &chan(const uint8_t ofs) override {
GCS_MAVLINK_Copter &chan(uint8_t ofs) override {
if (ofs >= num_gcs()) {
AP::internalerror().error(AP_InternalError::error_t::gcs_offset);
ofs = 0;
}
return _chan[ofs];
};
const GCS_MAVLINK_Copter &chan(const uint8_t ofs) const override {
}
const GCS_MAVLINK_Copter &chan(uint8_t ofs) const override {
if (ofs >= num_gcs()) {
AP::internalerror().error(AP_InternalError::error_t::gcs_offset);
ofs = 0;
}
return _chan[ofs];
};
}
void update_vehicle_sensor_status_flags(void) override;