Code

write_graphite: avoid printing out the NULL value in error messages
[collectd.git] / src / write_graphite.c
index 667c11e3dd9aca469c438c27d477fb718b6ad904..c3d6bf103490a7f2f4dfeefe33f6d42db0f9f39b 100644 (file)
@@ -131,8 +131,10 @@ static int wg_send_buffer (struct wg_callback *cb)
     if (cb->log_send_errors && status < 0)
     {
         char errbuf[1024];
+        const char *protocol = cb->protocol ? cb->protocol : WG_DEFAULT_PROTOCOL;
+
         ERROR ("write_graphite plugin: send to %s:%s (%s) failed with status %zi (%s)",
-                cb->node, cb->service, cb->protocol,
+                cb->node, cb->service, protocol,
                 status, sstrerror (errno, errbuf, sizeof (errbuf)));