summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox')
-rw-r--r--protocols/Tox/src/api_main.cpp3
-rw-r--r--protocols/Tox/src/tox_core.cpp7
2 files changed, 6 insertions, 4 deletions
diff --git a/protocols/Tox/src/api_main.cpp b/protocols/Tox/src/api_main.cpp
index cc46abcb63..5473c88f6f 100644
--- a/protocols/Tox/src/api_main.cpp
+++ b/protocols/Tox/src/api_main.cpp
@@ -19,8 +19,7 @@ Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error)
void tox_kill(Tox *tox)
{
- CreateFunction<int(*)(const Tox*)>(__FUNCTION__)(tox);
- tox = NULL;
+ CreateFunction<int(*)(Tox*)>(__FUNCTION__)(tox);
}
void tox_self_get_address(const Tox *tox, uint8_t *address)
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp
index fd6452745a..bcc75eb436 100644
--- a/protocols/Tox/src/tox_core.cpp
+++ b/protocols/Tox/src/tox_core.cpp
@@ -128,8 +128,11 @@ void CToxProto::UninitToxCore(CToxThread *toxThread)
SaveToxProfile();
- tox_kill(toxThread->tox);
- toxThread->tox = NULL;
+ if (toxThread->tox != NULL)
+ {
+ tox_kill(toxThread->tox);
+ toxThread->tox = NULL;
+ }
}
toxThread = NULL;
}