diff --git a/src/hints.c b/src/hints.c
index 8054284fb72985759eb4dfcf438f301bf6733324..9e46fff2e8d74a8b070fbdab0f6876baebdc2fa0 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -71,7 +71,7 @@ create_name_with_host (DisplayInfo *display_info, const gchar *name, const gchar
 {
     gchar *title = NULL;
     
-    if ((display_info->hostname) && (g_strcasecmp (display_info->hostname, hostname)))
+    if (strlen (hostname) && (display_info->hostname) && (g_strcasecmp (display_info->hostname, hostname)))
     {
         /* TRANSLATORS: "(on %s)" is like "running on" the name of the other host */
         title = g_strdup_printf (_("%s (on %s)"), name, hostname);