summary refs log tree commit diff stats
path: root/src/common/plugin.c
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-07-20 18:00:19 -0400
committerTingPing <tngpng@gmail.com>2013-07-20 18:00:19 -0400
commit13e9713b72d0e5a1450873fe09936fdac1e8268b (patch)
tree0ebc190c6eeb96f5dba1eb8d57b076aa32b2f88e /src/common/plugin.c
parentfe86c4900f369000ef2224a33e0d1c98f0f3d300 (diff)
Merge xchat r1525
Fixes possible crash
Diffstat (limited to 'src/common/plugin.c')
-rw-r--r--src/common/plugin.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 7d118b8b..50157ea1 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -522,7 +522,7 @@ plugin_hook_find (GSList *list, int type, char *name)
 	while (list)
 	{
 		hook = list->data;
-		if (hook->type == type)
+		if (hook && hook->type == type)
 		{
 			if (g_ascii_strcasecmp (hook->name, name) == 0)
 				return list;
@@ -600,7 +600,7 @@ xit:
 	{
 		hook = list->data;
 		next = list->next;
-		if (hook->type == HOOK_DELETED)
+		if (!hook || hook->type == HOOK_DELETED)
 		{
 			hook_list = g_slist_remove (hook_list, hook);
 			free (hook);
@@ -750,7 +750,7 @@ plugin_insert_hook (hexchat_hook *new_hook)
 	while (list)
 	{
 		hook = list->data;
-		if (hook->type == new_hook->type && hook->pri <= new_hook->pri)
+		if (hook && hook->type == new_hook->type && hook->pri <= new_hook->pri)
 		{
 			hook_list = g_slist_insert_before (hook_list, list, new_hook);
 			return;
@@ -828,7 +828,7 @@ plugin_command_list(GList *tmp_list)
 	while (list)
 	{
 		hook = list->data;
-		if (hook->type == HOOK_COMMAND)
+		if (hook && hook->type == HOOK_COMMAND)
 			tmp_list = g_list_prepend(tmp_list, hook->name);
 		list = list->next;
 	}
@@ -846,7 +846,7 @@ plugin_command_foreach (session *sess, void *userdata,
 	while (list)
 	{
 		hook = list->data;
-		if (hook->type == HOOK_COMMAND && hook->name[0])
+		if (hook && hook->type == HOOK_COMMAND && hook->name[0])
 		{
 			cb (sess, userdata, hook->name, hook->help_text);
 		}