Skip to content

Commit

Permalink
Add is_locked assert to register_state
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenCrowDev committed Dec 19, 2024
1 parent 304de75 commit 22e86d4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/fsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void FSM::_bind_methods() {
}

void FSM::register_state(const String &p_name, const Ref<FSMState> &p_state) {
NFSMG_ASSERT_RETURN_MSG(!fsm.is_locked(), "States cannot be registered while the FSM is locked.");
NFSMG_ASSERT_RETURN_MSG(!p_name.is_empty(), "State name cannot be empty.");
NFSMG_ASSERT_RETURN_MSG(!p_state.is_null(), "State cannot be null.");
NFSMG_ASSERT_RETURN_MSG(!state_map.has(p_name), ("State '" + to_std_string(p_name) + "' is already registered.").c_str());
Expand Down

0 comments on commit 22e86d4

Please sign in to comment.