diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/plugin.c | 10 | ||||
-rw-r--r-- | src/common/url.c | 7 |
2 files changed, 9 insertions, 8 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); } diff --git a/src/common/url.c b/src/common/url.c index 10479127..892441c8 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -350,8 +350,8 @@ do_an_re(const char *word, int *start, int *end, int *type) } /* Miscellaneous description --- */ -#define DOMAIN "[a-z0-9][-a-z0-9]*(\\.[-a-z0-9]+)*\\." -#define TLD "[a-z][-a-z0-9]*[a-z]" +#define DOMAIN "[a-z0-9][-a-z0-9]*(\\.[-a-z0-9]+)*" +#define TLD "\\.[a-z][-a-z0-9]*[a-z]" #define IPADDR "[0-9]{1,3}(\\.[0-9]{1,3}){3}" #define IPV6GROUP "([0-9a-f]{0,4})" #define IPV6ADDR "((" IPV6GROUP "(:" IPV6GROUP "){7})" \ @@ -359,6 +359,7 @@ do_an_re(const char *word, int *start, int *end, int *type) #define HOST "(" DOMAIN TLD "|" IPADDR "|" IPV6ADDR ")" /* In urls the IPv6 must be enclosed in square brackets */ #define HOST_URL "(" DOMAIN TLD "|" IPADDR "|" "\\[" IPV6ADDR "\\]" ")" +#define HOST_URL_OPT_TLD "(" DOMAIN "|" HOST_URL ")" #define PORT "(:[1-9][0-9]{0,4})" #define OPT_PORT "(" PORT ")?" @@ -517,7 +518,7 @@ re_url (void) g_string_append (grist_gstr, USERINFO "?"); if (uri[i].flags & URI_AUTHORITY) - g_string_append (grist_gstr, HOST_URL OPT_PORT); + g_string_append (grist_gstr, HOST_URL_OPT_TLD OPT_PORT); if (uri[i].flags & URI_PATH) { |