diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-20 19:17:42 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-20 19:17:42 +0200 |
| commit | 7dbc3bbe2ca65fb7ec200ab7aa713855b0bdc11d (patch) | |
| tree | 0239a0091e9b3fed9e4d4466d858d6724d157e4a /state.go | |
| parent | 5abf8464d66209ccd2b81aac1cdafea62b7852e2 (diff) | |
State Register: Fix crash if discoServers/discoOrgs is nil
Diffstat (limited to 'state.go')
| -rw-r--r-- | state.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -90,7 +90,7 @@ func (state *VPNState) Register( _, currentServerErr := state.Servers.GetCurrentServer() // Only actually return the error if we have no disco servers and no current server - if discoServersErr != nil && discoServers.Version == 0 && currentServerErr != nil { + if discoServersErr != nil && (discoServers == nil || discoServers.Version == 0) && currentServerErr != nil { state.Logger.Error( fmt.Sprintf( "No configured servers, discovery servers is empty and no servers with error: %s", @@ -102,7 +102,7 @@ func (state *VPNState) Register( discoOrgs, discoOrgsErr := state.GetDiscoOrganizations() // Only actually return the error if we have no disco organizations and no current server - if discoOrgsErr != nil && discoOrgs.Version == 0 && currentServerErr != nil { + if discoOrgsErr != nil && (discoOrgs == nil || discoOrgs.Version == 0) && currentServerErr != nil { state.Logger.Error( fmt.Sprintf( "No configured organizations, discovery organizations empty and no servers with error: %s", |
