Mercurial > hg
changeset 2185:f14537ee3476
Do not crash when using say_to . on a special buffer item
This should fix issue #140.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 01 Oct 2015 22:44:29 +0200 |
parents | f30459c47092 |
children | a852aed87ac0 |
files | mcabber/mcabber/commands.c |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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) {