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