]> git.meshlink.io Git - meshlink/commitdiff
Don't crash when the log callback gets a NULL mesh.
authorGuus Sliepen <guus@meshlink.io>
Sat, 9 Aug 2014 13:36:00 +0000 (15:36 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sat, 9 Aug 2014 13:36:00 +0000 (15:36 +0200)
examples/manynodes.c

index e00b80beeec203039fec0a353a65e827a62c2f5a..18299d9bb5fe9f60d1896d9e75a81d04f7958325 100644 (file)
@@ -22,7 +22,7 @@ static void log_message(meshlink_handle_t *mesh, meshlink_log_level_t level, con
                [MESHLINK_ERROR] = "\x1b[31mERROR",
                [MESHLINK_CRITICAL] = "\x1b[31mCRITICAL",
        };
-       fprintf(stderr, "%s\t%s:\x1b[0m %s\n", mesh->name,levelstr[level], text);
+       fprintf(stderr, "%s\t%s:\x1b[0m %s\n", mesh ? mesh->name : "global",levelstr[level], text);
 }
 
 //Test mesh sending data