]> git.meshlink.io Git - meshlink/commitdiff
Avoid a crash when graph() is called when the event loop is not running.
authorGuus Sliepen <guus@meshlink.io>
Tue, 21 Apr 2020 21:33:47 +0000 (23:33 +0200)
committerGuus Sliepen <guus@meshlink.io>
Tue, 21 Apr 2020 21:33:47 +0000 (23:33 +0200)
src/graph.c

index 050acbf5f4d45f0c375c5a077b139ccf9c1290b7..c6e413d40f6fae3e1a763d74ded701f209d2e409 100644 (file)
@@ -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)
                                });