mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-26 10:38:28 -04:00
GCS_MAVLink: serial control: avoid nullptr dererences
This commit is contained in:
parent
b864cd6ae6
commit
1f862e8192
@ -61,12 +61,22 @@ void GCS_MAVLINK::handle_serial_control(const mavlink_message_t *msg)
|
||||
break;
|
||||
case SERIAL_CONTROL_DEV_SHELL:
|
||||
stream = hal.util->get_shell_stream();
|
||||
if (stream == nullptr) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// not supported yet
|
||||
return;
|
||||
}
|
||||
|
||||
if (stream == nullptr) {
|
||||
// this is probably very bad
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
AP_HAL::panic("stream is nullptr");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (exclusive && port != nullptr) {
|
||||
// force flow control off for exclusive access. This protocol
|
||||
// is used to talk to bootloaders which may not have flow
|
||||
|
Loading…
Reference in New Issue
Block a user