Fix crashing on HSM update with state transition

This commit is contained in:
Serhii Snitsaruk 2024-02-26 21:34:30 +01:00
parent 9fbbea49a9
commit 1c01767a56
1 changed files with 5 additions and 2 deletions

View File

@ -87,11 +87,14 @@ void LimboHSM::_exit() {
void LimboHSM::_update(double p_delta) { void LimboHSM::_update(double p_delta) {
if (active) { if (active) {
ERR_FAIL_COND(active_state == nullptr); ERR_FAIL_NULL(active_state);
LimboState *last_active_state = active_state;
LimboState::_update(p_delta); LimboState::_update(p_delta);
if (last_active_state == active_state) {
active_state->_update(p_delta); active_state->_update(p_delta);
} }
} }
}
void LimboHSM::update(double p_delta) { void LimboHSM::update(double p_delta) {
_update(p_delta); _update(p_delta);