소스 검색

fix(core): Prevent error cause by order in outdated state

Michael Bromley 3 년 전
부모
커밋
2266293583
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      packages/core/src/common/finite-state-machine/finite-state-machine.ts

+ 1 - 1
packages/core/src/common/finite-state-machine/finite-state-machine.ts

@@ -76,7 +76,7 @@ export class FSM<T extends string, Data = any> {
      * Returns an array of state to which the machine may transition from the current state.
      * Returns an array of state to which the machine may transition from the current state.
      */
      */
     getNextStates(): ReadonlyArray<T> {
     getNextStates(): ReadonlyArray<T> {
-        return this.config.transitions[this._currentState].to;
+        return this.config.transitions[this._currentState]?.to ?? [];
     }
     }
 
 
     /**
     /**