From db71ab17865dd00a60be27bee6c749e0525f72f6 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 20 Apr 2022 14:45:41 +0200 Subject: FSM: Check if the FSM is defined for transitions and state checks --- src/fsm.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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 } -- cgit v1.2.3