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 Dec 9, 2024
1 parent 239e7fa commit 166e74c
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 166e74c

Please sign in to comment.