mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-04 23:18:29 -04:00
GCS_MAVLink: serial control: avoid nullptr dererences
This commit is contained in:
parent
b864cd6ae6
commit
1f862e8192
@ -61,11 +61,21 @@ void GCS_MAVLINK::handle_serial_control(const mavlink_message_t *msg)
|
|||||||
break;
|
break;
|
||||||
case SERIAL_CONTROL_DEV_SHELL:
|
case SERIAL_CONTROL_DEV_SHELL:
|
||||||
stream = hal.util->get_shell_stream();
|
stream = hal.util->get_shell_stream();
|
||||||
|
if (stream == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// not supported yet
|
// not supported yet
|
||||||
return;
|
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) {
|
if (exclusive && port != nullptr) {
|
||||||
// force flow control off for exclusive access. This protocol
|
// force flow control off for exclusive access. This protocol
|
||||||
|
Loading…
Reference in New Issue
Block a user