summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-26 15:46:30 +0100
committersin <sin@2f30.org>2014-09-26 15:46:30 +0100
commit7077107778a54cd326e3898318ce53da4de28fc5 (patch)
tree7b7a3f51861a6ecdd061d68778d17654444c636d /ratox.c
parent654c092951d9b55b77407f87aac0f49e13c7c20e (diff)
Check return value of tox_new()
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ratox.c b/ratox.c
index baef12c..ad1c55c 100644
--- a/ratox.c
+++ b/ratox.c
@@ -880,9 +880,16 @@ toxinit(void)
toxopt.proxy_enabled = 1;
printout("Using proxy %s:%hu\n", proxyaddr, proxyport);
}
+
tox = tox_new(&toxopt);
+ if (!tox) {
+ fprintf(stderr, "failed to initialize tox core\n");
+ exit(EXIT_FAILURE);
+ }
+
dataload();
datasave();
+
tox_callback_connection_status(tox, cbconnstatus, NULL);
tox_callback_friend_message(tox, cbfriendmessage, NULL);
tox_callback_friend_request(tox, cbfriendrequest, NULL);
@@ -892,6 +899,7 @@ toxinit(void)
tox_callback_file_control(tox, cbfilecontrol, NULL);
tox_callback_file_send_request(tox, cbfilesendreq, NULL);
tox_callback_file_data(tox, cbfiledata, NULL);
+
return 0;
}