diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-20 14:44:54 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-20 14:44:54 +0200 |
| commit | 30c7e666561cee8deafa25fd424c79b0b801c3fe (patch) | |
| tree | b69e9db08ff32d01bec7ec9bce78939f5a6686b9 /exports | |
| parent | 1c54936626a4a30d0c6f69576a06ba3661f39dc6 (diff) | |
Profiles: Return possible error message when setting ID
Diffstat (limited to 'exports')
| -rw-r--r-- | exports/exports.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/exports/exports.go b/exports/exports.go index af71eba..c9ef41b 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -76,23 +76,18 @@ func GetServersList() (*C.char, *C.char) { } //export SetProfileID -func SetProfileID(data *C.char) { +func SetProfileID(data *C.char) *C.char { state := eduvpn.GetVPNState() - // No server - if state.Server == nil { - return - } - - // No profiles for server - if state.Server.Profiles == nil { - return + if !state.InState(eduvpn.ASK_PROFILE) { + return C.CString("Invalid state for setting a profile") } // Set current profile to id profile_id := C.GoString(data) state.Server.Profiles.Current = profile_id + return C.CString("") } //export FreeString |
