mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-11-09 16:41:21 +08:00
AP_Scripting: prevent a code path to abort() in scripting
if scripting can't find an error handler it can call abort(). We don't ever want to do that in ArduPilot
This commit is contained in:
1 parent
4ad1231c8f
commit
f8097379cb
3 files changed
+22
-1
No files matched your search
@@ -956,4 +956,23 @@ int lua_range_finder_handle_script_msg(lua_State *L) {
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
lua wants to abort, and doesn't have access to a panic function
|
||||
*/
|
||||
void lua_abort()
|
||||
{
|
||||
INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
|
||||
#if AP_SIM_ENABLED
|
||||
AP_HAL::panic("lua_abort called");
|
||||
#else
|
||||
if (!hal.util->get_soft_armed()) {
|
||||
AP_HAL::panic("lua_abort called");
|
||||
}
|
||||
// abort while flying, all we can do is loop
|
||||
while (true) {
|
||||
hal.scheduler->delay(1000);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // AP_SCRIPTING_ENABLED
|
||||
Reference in new issue
Block a user