about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/ui/statusbar.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index c3b7c7b4..82fa5c66 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -199,10 +199,14 @@ _create_tab(const int win, win_type_t wintype, char *identifier, gboolean highli
             char *pref = prefs_get_string(PREF_STATUSBAR_CHAT);
             if (g_strcmp0("user", pref) == 0) {
                 Jid *jidp = jid_create(tab->identifier);
-                tab->display_name = jidp->localpart != NULL ?
-						strdup(jidp->localpart) :
-						strdup(jidp->barejid);
-                jid_destroy(jidp);
+                if (jidp) {
+                    tab->display_name = jidp->localpart != NULL ?
+                        strdup(jidp->localpart) :
+                        strdup(jidp->barejid);
+                    jid_destroy(jidp);
+                } else {
+                    tab->display_name = strdup(tab->identifier);
+                }
             } else {
                 tab->display_name = strdup(tab->identifier);
             }