forked from Archive/PX4-Autopilot
FlightTasks: hotfix guard against accessing no task
Safety guard for null pointer exception when accessing the current task when none is running. This could only happen if the running task was changed during the update because of command handling failing. Note: This is fixed on master in a different, better way.
This commit is contained in:
parent
a6274bc5ed
commit
21c82a4814
|
@ -150,14 +150,24 @@ public:
|
|||
/**
|
||||
* Sets an external yaw handler. The active flight task can use the yaw handler to implement a different yaw control strategy.
|
||||
*/
|
||||
void setYawHandler(WeatherVane *ext_yaw_handler) {_current_task.task->setYawHandler(ext_yaw_handler);}
|
||||
void setYawHandler(WeatherVane *ext_yaw_handler)
|
||||
{
|
||||
if (isAnyTaskActive()) {
|
||||
_current_task.task->setYawHandler(ext_yaw_handler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will re-activate current task.
|
||||
*/
|
||||
void reActivate();
|
||||
|
||||
void updateVelocityControllerIO(const matrix::Vector3f &vel_sp, const matrix::Vector3f &thrust_sp) {_current_task.task->updateVelocityControllerIO(vel_sp, thrust_sp); }
|
||||
void updateVelocityControllerIO(const matrix::Vector3f &vel_sp, const matrix::Vector3f &thrust_sp)
|
||||
{
|
||||
if (isAnyTaskActive()) {
|
||||
_current_task.task->updateVelocityControllerIO(vel_sp, thrust_sp);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in New Issue