From 3ed9fb8eed74721a9a6787f913182e3f25cfd5f9 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 28 Jul 2016 09:06:43 +0200 Subject: Clear last command status code on success Signed-off-by: Szczepan Zalega --- NK_C_API.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NK_C_API.cc b/NK_C_API.cc index 1e5da56..e07d518 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -15,6 +15,7 @@ template uint8_t * get_with_array_result(T func){ try { return func(); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -26,6 +27,7 @@ template const char* get_with_string_result(T func){ try { return func(); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -37,6 +39,7 @@ template auto get_with_result(T func){ try { return func(); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -48,6 +51,7 @@ template uint8_t get_without_result(T func){ try { func(); + NK_last_command_status = 0; return 0; } catch (CommandFailedException & commandFailedException){ @@ -69,6 +73,7 @@ extern int NK_login(const char *admin_pin, const char *temporary_password) { try { m->connect(); m->first_authenticate(admin_pin, temporary_password); + NK_last_command_status = 0; } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; -- cgit v1.2.3