changeset 28707:1e5b69e67677

Don't crash when $gc is undefined in a call to Purple::Prpl::send_raw. Should Fixes #10222
author Paul Aurich <paul@darkrain42.org>
date Fri, 09 Oct 2009 01:16:11 +0000
parents 24702a4affaa
children 911560d0c36f
files libpurple/plugins/perl/common/Prpl.xs
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Prpl.xs	Thu Oct 08 04:02:26 2009 +0000
+++ b/libpurple/plugins/perl/common/Prpl.xs	Fri Oct 09 01:16:11 2009 +0000
@@ -62,11 +62,15 @@
 PREINIT:
 	PurplePluginProtocolInfo *prpl_info;
 CODE:
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
-	if (prpl_info && prpl_info->send_raw != NULL) {
-		RETVAL = prpl_info->send_raw(gc, str, strlen(str));
-	} else {
+	if (!gc)
 		RETVAL = 0;
+	else {
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+		if (prpl_info && prpl_info->send_raw != NULL) {
+			RETVAL = prpl_info->send_raw(gc, str, strlen(str));
+		} else {
+			RETVAL = 0;
+		}
 	}
 OUTPUT:
 	RETVAL