From 22c472fdd1f532c2ceed60c1492394b84f73b0d1 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 7 Feb 2024 13:39:45 +0100 Subject: [PATCH] Disallow LimboHSM transitions to self when ANYSTATE is used Resolves #29 --- hsm/limbo_hsm.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hsm/limbo_hsm.cpp b/hsm/limbo_hsm.cpp index 1b1a146..49e9145 100644 --- a/hsm/limbo_hsm.cpp +++ b/hsm/limbo_hsm.cpp @@ -148,6 +148,10 @@ bool LimboHSM::dispatch(const String &p_event, const Variant &p_cargo) { key = _get_transition_key(nullptr, p_event); if (transitions.has(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) {