X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnet_setup.c;h=ce9a59ad230b0723e5bafeed12f312fed629b4a5;hb=efbdf1564bb6a8f17ca28e61ccc6a507f1159994;hp=8b0fd8fde443ced49bb80905bf7df3459ded601c;hpb=656a7bca4fd4acac5c3411087a6ed62fa4b7fa81;p=meshlink diff --git a/src/net_setup.c b/src/net_setup.c index 8b0fd8fd..ce9a59ad 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -377,11 +377,13 @@ bool setup_network(meshlink_handle_t *mesh) { close all open network connections */ void close_network_connections(meshlink_handle_t *mesh) { - for(list_node_t *node = mesh->connections->head, *next; node; node = next) { - next = node->next; - connection_t *c = node->data; - c->outgoing = NULL; - terminate_connection(mesh, c, false); + if(mesh->connections) { + for(list_node_t *node = mesh->connections->head, *next; node; node = next) { + next = node->next; + connection_t *c = node->data; + c->outgoing = NULL; + terminate_connection(mesh, c, false); + } } if(mesh->outgoings)