AP_Scripting: check for alloc failure of ObjectBuffer

This commit is contained in:
Andrew Tridgell 2023-01-02 08:33:22 +11:00 committed by Randy Mackay
parent 9154db9ae2
commit 68352534be

View File

@ -274,6 +274,10 @@ void AP_Scripting::handle_mission_command(const AP_Mission::Mission_Command& cmd
if (mission_data == nullptr) {
// load buffer
mission_data = new ObjectBuffer<struct AP_Scripting::scripting_mission_cmd>(mission_cmd_queue_size);
if (mission_data != nullptr && mission_data->get_size() == 0) {
delete mission_data;
mission_data = nullptr;
}
if (mission_data == nullptr) {
gcs().send_text(MAV_SEVERITY_INFO, "Scripting: %s", "unable to receive mission command");
return;