From ccd4945504a5db0a4f1334c31da6eec026dbb9d0 Mon Sep 17 00:00:00 2001 From: TingPing Date: Sat, 20 Jul 2013 18:00:19 -0400 Subject: [PATCH] Merge xchat r1525 Fixes possible crash --- src/common/plugin.c | 10 +++++----- 1 file 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); }