/srv/mercurial-server/detachablepurple: 6c7efcb294b7: Fix: check...

Gilles Bedel gillux at cpw.pidgin.im
Fri Jun 15 22:01:46 EDT 2012


Changeset: 6c7efcb294b746ca26a9e569987010270271c722
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2012-05-20 17:09 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/6c7efcb294b7

Description:

Fix: check whether a buddy have a name
before using it in its dbus path name.

diffstat:

 libpurple/dbus/buddy.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (28 lines):

diff --git a/libpurple/dbus/buddy.c b/libpurple/dbus/buddy.c
--- a/libpurple/dbus/buddy.c
+++ b/libpurple/dbus/buddy.c
@@ -26,6 +26,7 @@
 #include "dbus/buddy.xml.h"
 #include "dbus-purple.h"
 #include "dbus-server.h"
+#include "pobject.h"
 
 static char *
 purple_buddy_build_dbus_path(PurpleObject *pobject)
@@ -39,9 +40,13 @@
 
 	/* Buddy names arn't unique, so we use an id. We also append the buddy
 	 * name, to make a meaningful path. */
-	name_valid = purple_dbus_sanitize_dbus_path(name);
-	path = g_strdup_printf(DBUS_BUDDY_PATH "/%u_%s", buddy_id++, name_valid);
-	g_free(name_valid);
+	if (name) {
+		name_valid = purple_dbus_sanitize_dbus_path(name);
+		path = g_strdup_printf(DBUS_BUDDY_PATH "/%u_%s", buddy_id++, name_valid);
+		g_free(name_valid);
+	} else {
+		path = g_strdup_printf(DBUS_BUDDY_PATH "/%u", buddy_id++);
+	}
 
 	return path;
 }



More information about the Commits mailing list