mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:33:02 +01:00
Merge pull request #32 from FullName/Delta
if tox_new() fails, don't crash and leave the terminal in a broken state
This commit is contained in:
commit
2e84836f8c
@ -91,6 +91,8 @@ static Tox *init_tox()
|
|||||||
{
|
{
|
||||||
/* Init core */
|
/* Init core */
|
||||||
Tox *m = tox_new();
|
Tox *m = tox_new();
|
||||||
|
if (!m)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
tox_callback_connectionstatus(m, on_connectionchange, NULL);
|
tox_callback_connectionstatus(m, on_connectionchange, NULL);
|
||||||
@ -403,6 +405,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
init_term();
|
init_term();
|
||||||
Tox *m = init_tox();
|
Tox *m = init_tox();
|
||||||
|
if (!m) {
|
||||||
|
endwin();
|
||||||
|
fprintf(stderr, "Failed to initialize network. Aborting...\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
prompt = init_windows(m);
|
prompt = init_windows(m);
|
||||||
|
|
||||||
if (f_loadfromfile)
|
if (f_loadfromfile)
|
||||||
|
Loading…
Reference in New Issue
Block a user