From 1c01767a563acfb381007834dbc62665a8265096 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 26 Feb 2024 21:34:30 +0100 Subject: [PATCH] Fix crashing on HSM update with state transition --- hsm/limbo_hsm.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hsm/limbo_hsm.cpp b/hsm/limbo_hsm.cpp index 49e9145..37a190f 100644 --- a/hsm/limbo_hsm.cpp +++ b/hsm/limbo_hsm.cpp @@ -87,9 +87,12 @@ void LimboHSM::_exit() { void LimboHSM::_update(double p_delta) { if (active) { - ERR_FAIL_COND(active_state == nullptr); + ERR_FAIL_NULL(active_state); + LimboState *last_active_state = active_state; LimboState::_update(p_delta); - active_state->_update(p_delta); + if (last_active_state == active_state) { + active_state->_update(p_delta); + } } }