# HG changeset patch # User Mikael Berthe # Date 1443732269 -7200 # Node ID f14537ee347662d4e91338266fcdd73342b2f521 # Parent f30459c470924f83caf4ee6cfa17f03b1add6ef8 Do not crash when using say_to . on a special buffer item This should fix issue #140. diff -r f30459c47092 -r f14537ee3476 mcabber/mcabber/commands.c --- a/mcabber/mcabber/commands.c Tue Sep 22 21:36:45 2015 +0200 +++ b/mcabber/mcabber/commands.c Thu Oct 01 22:44:29 2015 +0200 @@ -1690,14 +1690,24 @@ if (fjid[1] == '\0') { fjid = g_strdup(cjid); } else if (fjid[1] == JID_RESOURCE_SEPARATOR) { - char *res_utf8 = to_utf8(fjid+2); - fjid = g_strdup_printf("%s%c%s", cjid, JID_RESOURCE_SEPARATOR, res_utf8); - g_free(res_utf8); + if (!cjid) { + fjid = NULL; + } else { + char *res_utf8 = to_utf8(fjid+2); + fjid = g_strdup_printf("%s%c%s", cjid, JID_RESOURCE_SEPARATOR, res_utf8); + g_free(res_utf8); + } } else fjid = to_utf8(fjid); } else fjid = to_utf8(fjid); + if (!fjid) { + scr_LogPrint(LPRINT_NORMAL, "The Jabber ID is invalid."); + free_arg_lst(paramlst); + return; + } + if (!strchr(fjid, JID_DOMAIN_SEPARATOR)) { const gchar *append_server = settings_opt_get("default_server"); if (append_server) {