diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-26 17:09:52 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-26 17:09:52 +0200 |
| commit | 516a25eb926a8b9a879e4f38c86d4dbb9b9e0948 (patch) | |
| tree | 5e1adb12ebab7b6f770102a179afb2a7db9e479f /wrappers/python/eduvpn_common/server.py | |
| parent | b4be281671ecfe5c1e6f831614ca1dde48522cd7 (diff) | |
Client + Exports + Python: Add a function for getting the current server
Diffstat (limited to 'wrappers/python/eduvpn_common/server.py')
| -rw-r--r-- | wrappers/python/eduvpn_common/server.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/wrappers/python/eduvpn_common/server.py b/wrappers/python/eduvpn_common/server.py index fc5711e..3a5ff69 100644 --- a/wrappers/python/eduvpn_common/server.py +++ b/wrappers/python/eduvpn_common/server.py @@ -245,9 +245,11 @@ def get_transition_server(lib: CDLL, ptr: c_void_p) -> Optional[Server]: :return: The server if there is any :rtype: Optional[Server] """ - server = get_server(cast(ptr, POINTER(cServer))) - lib.FreeServer(ptr) - return server + if ptr: + server = get_server(cast(ptr, POINTER(cServer))) + lib.FreeServer(ptr) + return server + return None def get_transition_profiles(lib: CDLL, ptr: c_void_p) -> Optional[Profiles]: @@ -261,9 +263,11 @@ def get_transition_profiles(lib: CDLL, ptr: c_void_p) -> Optional[Profiles]: :return: The profiles if there is any :rtype: Optional[Profiles] """ - profiles = get_profiles(cast(ptr, POINTER(cServerProfiles))) - lib.FreeProfiles(ptr) - return profiles + if ptr: + profiles = get_profiles(cast(ptr, POINTER(cServerProfiles))) + lib.FreeProfiles(ptr) + return profiles + return None def get_servers(lib: CDLL, ptr: c_void_p) -> Optional[List[Server]]: |
