diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-22 09:56:50 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | f5fe3d75801830ab9f1d380f5b3238b9006cf48b (patch) | |
| tree | 4179c591d37e2781f0cc43c8d3c17ebdfd6da878 /exports | |
| parent | 713f93c46065a8af3509311e428c0ea7db9da5c8 (diff) | |
Exports + Client Register: Make sure to only update state if no err
Diffstat (limited to 'exports')
| -rw-r--r-- | exports/exports.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/exports/exports.go b/exports/exports.go index b38d0ff..0779104 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -101,8 +101,6 @@ func Register( return getCError(errors.New("failed to register, a VPN state is already present")) } state := &client.Client{} - VPNState = state - PStateCallback = stateCallback registerErr := state.Register( C.GoString(name), C.GoString(version), @@ -110,6 +108,12 @@ func Register( StateCallback, debug != 0, ) + // Only update the VPN state if we get no error when registering + if registerErr == nil { + VPNState = state + PStateCallback = stateCallback + return nil + } return getCError(registerErr) } |
