summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-20 14:45:41 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-20 14:45:41 +0200
commitdb71ab17865dd00a60be27bee6c749e0525f72f6 (patch)
tree90df7552d23019eae1e36f38dc8d94ceadada72e
parent30c7e666561cee8deafa25fd424c79b0b801c3fe (diff)
FSM: Check if the FSM is defined for transitions and state checks
-rw-r--r--src/fsm.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fsm.go b/src/fsm.go
index 7eb1ca1..2e778d9 100644
--- a/src/fsm.go
+++ b/src/fsm.go
@@ -93,6 +93,10 @@ type FSM struct {
}
func (eduvpn *VPNState) HasTransition(check FSMStateID) bool {
+ // No fsm
+ if eduvpn.FSM == nil {
+ return false
+ }
for _, transition_state := range eduvpn.FSM.States[eduvpn.FSM.Current] {
if transition_state.To == check {
return true
@@ -103,6 +107,10 @@ func (eduvpn *VPNState) HasTransition(check FSMStateID) bool {
}
func (eduvpn *VPNState) InState(check FSMStateID) bool {
+ // No fsm
+ if eduvpn.FSM == nil {
+ return false
+ }
return check == eduvpn.FSM.Current
}