From 7e62d458ee22e9171bf5741cda5c8ce85b20bd6a Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 9 Mar 2020 16:33:42 +0100 Subject: Make statusbar tab more resilient If users input strange stuff and we can't create a jid from it even the setting is set to 'user' we still should fallback to the regular identifer. For example with `/msg @name%matrix.domain.org@matrix.org hi`. --- src/ui/statusbar.c | 12 ++++++++---- 1 file 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); } -- cgit 1.4.1-2-gfad0