From: Guus Sliepen Date: Sat, 9 Aug 2014 13:36:00 +0000 (+0200) Subject: Don't crash when the log callback gets a NULL mesh. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=8a3a2fd2982d28e6e02baa0446d55ad28e4fbbdf;p=meshlink Don't crash when the log callback gets a NULL mesh. --- diff --git a/examples/manynodes.c b/examples/manynodes.c index e00b80be..18299d9b 100644 --- a/examples/manynodes.c +++ b/examples/manynodes.c @@ -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