summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.c b/main.c
index 9d3d495..45f415a 100644
--- a/main.c
+++ b/main.c
@@ -489,6 +489,12 @@ int parse_lossless_packet(void *sender_uc, const uint8_t *data, uint32_t len)
489 return -1; 489 return -1;
490 } 490 }
491 491
492 if(!data)
493 {
494 fprintf(stderr, "Got NULL pointer from toxcore - WTF?\n");
495 return -1;
496 }
497
492 if(data[0] != PROTOCOL_MAGIC_HIGH || data[1] != PROTOCOL_MAGIC_LOW) 498 if(data[0] != PROTOCOL_MAGIC_HIGH || data[1] != PROTOCOL_MAGIC_LOW)
493 { 499 {
494 fprintf(stderr, "Received data frame with invalid protocol magic number 0x%x%x\n", data[0], data[1]); 500 fprintf(stderr, "Received data frame with invalid protocol magic number 0x%x%x\n", data[0], data[1]);
@@ -835,6 +841,19 @@ int main(int argc, char *argv[])
835 tox_options.proxy_enabled = 0; 841 tox_options.proxy_enabled = 0;
836 842
837 tox = tox_new(&tox_options); 843 tox = tox_new(&tox_options);
844 if(tox == NULL)
845 {
846 fprintf(stderr, "tox_new() failed - trying without proxy\n");
847 if(!tox_options.proxy_enabled || (tox_options.proxy_enabled = 0, (tox = tox_new(&tox_options)) == NULL))
848 {
849 fprintf(stderr, "tox_new() failed - trying without IPv6\n");
850 if(!tox_options.ipv6enabled || (tox_options.ipv6enabled = 0, (tox = tox_new(&tox_options)) == NULL))
851 {
852 fprintf(stderr, "tox_new() failed - exiting\n");
853 exit(1);
854 }
855 }
856 }
838 857
839 set_tox_username(tox); 858 set_tox_username(tox);
840 859