Merge xchat r1525

Fixes possible crash
This commit is contained in:
TingPing 2013-07-20 18:00:19 -04:00
parent fe86c4900f
commit 13e9713b72
1 changed files with 5 additions and 5 deletions

View File

@ -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);
}