changeset 10868:4a56b48dbaa6

[gaim-migrate @ 12555] Don't try to send if charset conversion isn't successful. This is entirely untested. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 25 Apr 2005 03:41:16 +0000
parents 5727afad0fb8
children 3e43c132f151
files src/protocols/gg/gg.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/gg/gg.c	Mon Apr 25 01:53:01 2005 +0000
+++ b/src/protocols/gg/gg.c	Mon Apr 25 03:41:16 2005 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 12546 2005-04-24 20:49:55Z thekingant $
+ * $Id: gg.c 12555 2005-04-25 03:41:16Z datallah $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  *
@@ -936,7 +936,6 @@
 static int agg_send_im(GaimConnection *gc, const char *who, const char *msg, GaimConvImFlags flags)
 {
 	struct agg_data *gd = (struct agg_data *)gc->proto_data;
-	gchar *imsg;
 
 	if (invalid_uin(who)) {
 		gaim_notify_error(gc, NULL,
@@ -946,11 +945,14 @@
 	}
 
 	if (strlen(msg) > 0) {
-		imsg = charset_convert(msg, "UTF-8", "CP1250");
-		if (gg_send_message(gd->sess, GG_CLASS_CHAT,
+		gchar *imsg = charset_convert(msg, "UTF-8", "CP1250");
+		if (imsg != NULL && strlen(imsg) > 0) {
+			if (gg_send_message(gd->sess, GG_CLASS_CHAT,
 				    strtol(who, (char **)NULL, 10), imsg) < 0)
-			return -1;
-		g_free(imsg);
+				return -1;
+		}
+		if (imsg != NULL)
+			g_free(imsg);
 	}
 	return 1;
 }