changeset 18356:823b3a3191fc

merge of '32cacc02ac154597af16ab9465ee19dc75149903' and 'e2ba19f94867654f67522ab62256281645a9df9f'
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 29 Jun 2007 15:03:27 +0000
parents e356256cb8a6 (diff) cafecb0e4147 (current diff)
children 2177a11e169d
files
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/imgstore.c	Fri Jun 29 13:32:49 2007 +0000
+++ b/libpurple/imgstore.c	Fri Jun 29 15:03:27 2007 +0000
@@ -55,8 +55,8 @@
 {
 	PurpleStoredImage *img;
 
-	g_return_val_if_fail(data != NULL, 0);
-	g_return_val_if_fail(size > 0, 0);
+	g_return_val_if_fail(data != NULL, NULL);
+	g_return_val_if_fail(size > 0, NULL);
 
 	img = g_new(PurpleStoredImage, 1);
 	PURPLE_DBUS_REGISTER_POINTER(img, PurpleStoredImage);
@@ -73,11 +73,13 @@
 purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename)
 {
 	PurpleStoredImage *img = purple_imgstore_add(data, size, filename);
-	img->id = ++nextid;
+	if (img) {
+		img->id = ++nextid;
 
-	g_hash_table_insert(imgstore, &(img->id), img);
+		g_hash_table_insert(imgstore, &(img->id), img);
+	}
 
-	return img->id;
+	return (img ? img->id : 0);
 }
 
 PurpleStoredImage *purple_imgstore_find_by_id(int id) {