diff src/gtkutils.c @ 8363:19459d9eead2

[gaim-migrate @ 9088] Nice patch from nosnilmot to make AIM icons work better. My testing made me realize 2 things still don't work well: Gaim doesn't clear icons when someone else sets their icon to nothing Gaim doesn't show some icons. Maybe the official ones? With the shorter, constant checksum thing? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 28 Feb 2004 22:45:34 +0000
parents e39ea2b4f6cd
children 95afeb9a0c96
line wrap: on
line diff
--- a/src/gtkutils.c	Sat Feb 28 21:14:51 2004 +0000
+++ b/src/gtkutils.c	Sat Feb 28 22:45:34 2004 +0000
@@ -282,14 +282,12 @@
 	if (gaim_gtk_check_if_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon)))
 		return;
 
-	if ((file = fopen(f, "w")) != NULL) {
-		GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(c));
-		size_t len;
-		const void *data = gaim_buddy_icon_get_data(icon, &len);
+	GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(c));
+	size_t len;
+	const void *data = gaim_buddy_icon_get_data(icon, &len);
 
-		if (data)
-			fwrite(data, 1, len, file);
-
+	if ((len > 0) && (data != NULL) && (file = fopen(f, "wb")) != NULL) {
+		fwrite(data, 1, len, file);
 		fclose(file);
 	} else {
 		gaim_notify_error(NULL, NULL,