diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 03480e0c5fe2733761c3b63fb98904fc40c9353e..daeee2a856814743ebc3850ec9647933503a4a9e 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -499,7 +499,8 @@ _massage_logfile(void)
 	char *ptr, *new_fname;
 	int new_len;
 
-	if ((ptr = strstr(conf->logfile, "%h")) == NULL)
+	if ((conf->logfile == NULL)
+	||  (ptr = strstr(conf->logfile, "%h")) == NULL)
 		return;
 
 	new_len = strlen(conf->logfile) + strlen(conf->hostname);