Skip to content

Commit

Permalink
Merge pull request #8 from GreenCrowDev/fix-register-state
Browse files Browse the repository at this point in the history
Add `is_locked` assert to `register_state`
  • Loading branch information
GreenCrowDev authored Dec 19, 2024
2 parents 304de75 + 22e86d4 commit 6c1313b
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 6c1313b

Please sign in to comment.