Skip to content

Commit

Permalink
fix(FSMBehavior): Prevent state changes out of FINAL state
Browse files Browse the repository at this point in the history
  • Loading branch information
ettersi committed Jan 3, 2025
1 parent bfeb017 commit 3aa68a3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/arl/fjage/FSMBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void setInitialState(Object name) {
public void setNextState(Object name) {
State state = (name instanceof State) ? (State)name : states.get(name);
if (state == null) throw new FjageException("Unknown state: "+name);
if (next == FINAL) return;
next = state;
restart();
}
Expand All @@ -171,6 +172,7 @@ public void setNextState(Object name) {
* to be exited, and re-entered.
*/
public void reenterState() {
if (next == FINAL) return;
next = REENTER;
restart();
}
Expand Down

0 comments on commit 3aa68a3

Please sign in to comment.