# HG changeset patch # User Elliott Sales de Andrade # Date 1220817484 0 # Node ID 2ecdd0403dc1d13d52b1110fd650f0830f4443cc # Parent eb4d0636cf88b9cd9ac2f3b07b0c56e00304d1c0 Don't try to read data from a NULL filename in purple_buddy_icons_node_set_custom_icon_from_file. Also document that you can use NULL to unset the icon. Fixes #6998. diff -r eb4d0636cf88 -r 2ecdd0403dc1 libpurple/buddyicon.c --- a/libpurple/buddyicon.c Sun Sep 07 19:08:04 2008 +0000 +++ b/libpurple/buddyicon.c Sun Sep 07 19:58:04 2008 +0000 @@ -934,8 +934,8 @@ purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, const gchar *filename) { - size_t len; - guchar *data; + size_t len = 0; + guchar *data = NULL; g_return_val_if_fail(node != NULL, NULL); @@ -945,8 +945,10 @@ return NULL; } - if (!read_icon_file(filename, &data, &len)) { - return NULL; + if (filename != NULL) { + if (!read_icon_file(filename, &data, &len)) { + return NULL; + } } return purple_buddy_icons_node_set_custom_icon(node, data, len); diff -r eb4d0636cf88 -r 2ecdd0403dc1 libpurple/buddyicon.h --- a/libpurple/buddyicon.h Sun Sep 07 19:08:04 2008 +0000 +++ b/libpurple/buddyicon.h Sun Sep 07 19:58:04 2008 +0000 @@ -308,7 +308,7 @@ * * @param node The blist node for which to set a custom icon. * @param icon_data The image data of the icon, which the buddy icon code will - * free. + * free. Use NULL to unset the icon. * @param icon_len The length of the data in @a icon_data. * * @return The icon that was set. The caller does NOT own a reference to this, @@ -326,7 +326,8 @@ * @see purple_buddy_icons_node_set_custom_icon() * * @param node The blist node for which to set a custom icon. - * @param filename The path to the icon to set for the blist node. + * @param filename The path to the icon to set for the blist node. Use NULL + * to unset the custom icon. * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one.