/soc/2013/ankitkv/gobjectification: 8959b4ffee99: Added a protoc...

Ankit Vani a at nevitus.org
Fri Sep 13 11:12:28 EDT 2013


Changeset: 8959b4ffee999ea20dfdf2a574f836ec2a499b71
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-13 20:12 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/8959b4ffee99

Description:

Added a protocol error check for abstract types

diffstat:

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

diffs (24 lines):

diff --git a/libpurple/protocols.c b/libpurple/protocols.c
--- a/libpurple/protocols.c
+++ b/libpurple/protocols.c
@@ -795,8 +795,20 @@ purple_protocols_add(GType protocol_type
 		return NULL;
 	}
 
+	if (G_TYPE_IS_ABSTRACT(protocol_type)) {
+		g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
+		            _("Protocol type is abstract"));
+		return NULL;
+	}
+
 	protocol = g_object_new(protocol_type, NULL);
 
+	if (!protocol) {
+		g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
+		            _("Could not create protocol instance"));
+		return NULL;
+	}
+
 	if (!purple_protocol_get_id(protocol)) {
 		g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
 		            _("Protocol does not provide an ID"));



More information about the Commits mailing list