Disallow LimboHSM transitions to self when ANYSTATE is used

Resolves #29
This commit is contained in:
Serhii Snitsaruk 2024-02-07 13:39:45 +01:00
parent 449538d6d3
commit 22c472fdd1
1 changed files with 4 additions and 0 deletions

View File

@ -148,6 +148,10 @@ bool LimboHSM::dispatch(const String &p_event, const Variant &p_cargo) {
key = _get_transition_key(nullptr, p_event); key = _get_transition_key(nullptr, p_event);
if (transitions.has(key)) { if (transitions.has(key)) {
to_state = transitions[key]; to_state = transitions[key];
if (to_state == active_state) {
// Transitions to self are not allowed with ANYSTATE.
to_state = nullptr;
}
} }
} }
if (to_state != nullptr) { if (to_state != nullptr) {