From: Guus Sliepen Date: Tue, 21 Apr 2020 21:33:47 +0000 (+0200) Subject: Avoid a crash when graph() is called when the event loop is not running. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=42fe08d7834df4ef2c12af9f78d14f606dc4651d;p=meshlink Avoid a crash when graph() is called when the event loop is not running. --- diff --git a/src/graph.c b/src/graph.c index 050acbf5..c6e413d4 100644 --- a/src/graph.c +++ b/src/graph.c @@ -228,7 +228,7 @@ static void check_reachability(meshlink_handle_t *mesh) { if(!reachable) { mesh->last_unreachable = mesh->loop.now.tv_sec; - if(mesh->threadstarted) { + if(mesh->threadstarted && mesh->periodictimer.cb) { timeout_set(&mesh->loop, &mesh->periodictimer, &(struct timespec) { 0, prng(mesh, TIMER_FUDGE) });