/soc/2013/ankitkv/gobjectification: 4129d1ac5c1e: Check if a pro...

Ankit Vani a at nevitus.org
Thu Aug 29 20:20:35 EDT 2013


Changeset: 4129d1ac5c1e8d6044b0fbadb6771134a7891696
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-30 04:34 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/4129d1ac5c1e

Description:

Check if a protocol type is valid before adding it

diffstat:

 libpurple/protocols.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff --git a/libpurple/protocols.c b/libpurple/protocols.c
--- a/libpurple/protocols.c
+++ b/libpurple/protocols.c
@@ -704,7 +704,11 @@ purple_find_protocol_info(const char *id
 PurpleProtocol *
 purple_protocols_add(GType protocol_type)
 {
-	PurpleProtocol *protocol = g_object_new(protocol_type, NULL);
+	PurpleProtocol *protocol;
+
+	g_return_val_if_fail(type != G_TYPE_INVALID && type != G_TYPE_NONE, NULL);
+
+	protocol = g_object_new(protocol_type, NULL);
 	if (purple_find_protocol_info(purple_protocol_get_id(protocol))) {
 		g_object_unref(protocol);
 		return NULL;



More information about the Commits mailing list