Code

main: don't show (null) as the server name
[ncmpc.git] / src / main.c
index 5b31f41a410dcec78d3cb907e41264cd18addeb3..185ca5d97405a25a2950ff6ba0520c13dc1d4d0d 100644 (file)
@@ -285,7 +285,13 @@ connection_settings_name(const struct mpd_connection *connection)
        return settings_name(settings);
 #else
        (void)connection;
-       return g_strdup(options.host);
+
+       /*
+        * localhost is actually not correct, we only know that
+        * mpd_connection_new() has connected to the "default host".
+        */
+       const char *name = options.host ?: "localhost";
+       return g_strdup(name);
 #endif
 }