GCS_MAVLink: Ensure serial tunnel avoids nullptr

This commit is contained in:
Stephen Dade 2022-12-14 11:34:19 +11:00 committed by Andrew Tridgell
parent 151770f6e7
commit 55f31d628a

View File

@ -80,7 +80,7 @@ void GCS_MAVLINK::handle_serial_control(const mavlink_message_t &msg)
stream = port = AP::serialmanager().get_serial_by_id(packet.device - SERIAL_CONTROL_SERIAL0);
// see if we need to lock mavlink
for (uint8_t i=0; i<MAVLINK_COMM_NUM_BUFFERS; i++) {
for (uint8_t i=0; i<gcs().num_gcs(); i++) {
GCS_MAVLINK *link = gcs().chan(i);
if (link == nullptr || link->get_uart() != port) {
continue;