summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/src/api_connection.cpp4
-rw-r--r--protocols/Tox/src/tox_address.h5
-rw-r--r--protocols/Tox/src/tox_network.cpp5
3 files changed, 8 insertions, 6 deletions
diff --git a/protocols/Tox/src/api_connection.cpp b/protocols/Tox/src/api_connection.cpp
index 3b3ffb4143..6a854612fb 100644
--- a/protocols/Tox/src/api_connection.cpp
+++ b/protocols/Tox/src/api_connection.cpp
@@ -4,11 +4,15 @@
int tox_bootstrap_from_address(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key)
{
+ if (public_key == NULL)
+ return 0;
return CreateFunction<int(*)(Tox*, const char*, uint16_t, const uint8_t*)>(__FUNCTION__)(tox, address, port, public_key);
}
int tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key)
{
+ if (public_key == NULL)
+ return 0;
return CreateFunction<int(*)(Tox*, const char*, uint16_t, const uint8_t*)>(__FUNCTION__)(tox, address, port, public_key);
}
diff --git a/protocols/Tox/src/tox_address.h b/protocols/Tox/src/tox_address.h
index d205eb731e..a4b152427d 100644
--- a/protocols/Tox/src/tox_address.h
+++ b/protocols/Tox/src/tox_address.h
@@ -53,11 +53,6 @@ public:
}
ToxBinAddress(const char *hex)
{
- if (hex == NULL) {
- binData.resize(32);
- return;
- }
-
char *endptr;
const char *pos = hex;
int size = mir_strlen(hex) / 2;
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 53c83085c0..70ea5665c4 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -34,7 +34,10 @@ void CToxProto::BootstrapDht()
int port = db_get_w(NULL, "TOX", setting, 0);
mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, i + 1);
ptrA pubKey(db_get_sa(NULL, "TOX", setting));
- tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
+ if (pubKey && address)
+ {
+ tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
+ }
}
}
}