diff --git a/src/lib/flight_tasks/FlightTasks.hpp b/src/lib/flight_tasks/FlightTasks.hpp index 919e7be610..2c40b66fe1 100644 --- a/src/lib/flight_tasks/FlightTasks.hpp +++ b/src/lib/flight_tasks/FlightTasks.hpp @@ -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: