[xchat-gnome] Bug 652866 - don't dereference a NULL plugin



commit 134951439ef9c1ab85baec20cd29b1665e2d262f
Author: Bill Nottingham <notting redhat com>
Date:   Mon Jun 20 17:55:09 2011 +0530

    Bug 652866 - don't dereference a NULL plugin

 plugins/python/python.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 53267a3..bcceed1 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -791,6 +791,8 @@ static PyObject *
 Context_set(ContextObject *self, PyObject *args)
 {
 	PyObject *plugin = Plugin_GetCurrent();
+	if (plugin == NULL)
+		return NULL;
 	Plugin_SetContext(plugin, self->context);
 	Py_INCREF(Py_None);
 	return Py_None;
@@ -867,8 +869,11 @@ static PyObject *
 Context_get_list(ContextObject *self, PyObject *args)
 {
 	PyObject *plugin = Plugin_GetCurrent();
-	xchat_context *saved_context = Plugin_GetContext(plugin);
+	xchat_context *saved_context;
 	PyObject *ret;
+	if (plugin == NULL)
+		return NULL;
+	saved_context = Plugin_GetContext(plugin);
 	Plugin_SetContext(plugin, self->context);
 	ret = Module_xchat_get_list((PyObject*)self, args);
 	Plugin_SetContext(plugin, saved_context);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]