comparison mcabber/mcabber/commands.c @ 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 038c4d601011
children a852aed87ac0
comparison
equal deleted inserted replaced
2184:f30459c47092 2185:f14537ee3476
1688 if (fjid[0] == '.') { 1688 if (fjid[0] == '.') {
1689 const gchar *cjid = (current_buddy ? CURRENT_JID : NULL); 1689 const gchar *cjid = (current_buddy ? CURRENT_JID : NULL);
1690 if (fjid[1] == '\0') { 1690 if (fjid[1] == '\0') {
1691 fjid = g_strdup(cjid); 1691 fjid = g_strdup(cjid);
1692 } else if (fjid[1] == JID_RESOURCE_SEPARATOR) { 1692 } else if (fjid[1] == JID_RESOURCE_SEPARATOR) {
1693 char *res_utf8 = to_utf8(fjid+2); 1693 if (!cjid) {
1694 fjid = g_strdup_printf("%s%c%s", cjid, JID_RESOURCE_SEPARATOR, res_utf8); 1694 fjid = NULL;
1695 g_free(res_utf8); 1695 } else {
1696 char *res_utf8 = to_utf8(fjid+2);
1697 fjid = g_strdup_printf("%s%c%s", cjid, JID_RESOURCE_SEPARATOR, res_utf8);
1698 g_free(res_utf8);
1699 }
1696 } else 1700 } else
1697 fjid = to_utf8(fjid); 1701 fjid = to_utf8(fjid);
1698 } else 1702 } else
1699 fjid = to_utf8(fjid); 1703 fjid = to_utf8(fjid);
1704
1705 if (!fjid) {
1706 scr_LogPrint(LPRINT_NORMAL, "The Jabber ID is invalid.");
1707 free_arg_lst(paramlst);
1708 return;
1709 }
1700 1710
1701 if (!strchr(fjid, JID_DOMAIN_SEPARATOR)) { 1711 if (!strchr(fjid, JID_DOMAIN_SEPARATOR)) {
1702 const gchar *append_server = settings_opt_get("default_server"); 1712 const gchar *append_server = settings_opt_get("default_server");
1703 if (append_server) { 1713 if (append_server) {
1704 gchar *res = strchr(fjid, JID_RESOURCE_SEPARATOR); 1714 gchar *res = strchr(fjid, JID_RESOURCE_SEPARATOR);