diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 969f789f58..0d3fc9ef63 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -2944,13 +2944,13 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s } /* we know something has changed - check if we are in mode slot operation */ - if (_last_sp_man.mode_slot > 0) { + if (sp_man->mode_slot > 0) { - if (_last_sp_man.mode_slot >= sizeof(_flight_mode_slots) / sizeof(_flight_mode_slots[0])) { + if (sp_man->mode_slot >= sizeof(_flight_mode_slots) / sizeof(_flight_mode_slots[0])) { return TRANSITION_DENIED; } - int new_mode = _flight_mode_slots[_last_sp_man.mode_slot]; + int new_mode = _flight_mode_slots[sp_man->mode_slot]; if (new_mode < 0) { /* slot is unused */