summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-03-19 19:59:02 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-03-19 19:59:02 +0100
commit89160c565eec822d5c11d60355878545298c707c (patch)
treea37efdd8d5a8dd3c3f7dbbb3aef7a5c31db68b65 /src
parentb09fbea9547f694cd8a74a49b98c5f10d1cf99a6 (diff)
downloadweechat-89160c565eec822d5c11d60355878545298c707c.zip
core: fix add of filter on OS X when regex for message is empty (filter regex ending with "\t")
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-filter.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index dc2342efe..8e57e58d9 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -284,6 +284,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
regex1 = NULL;
regex2 = NULL;
+
if (strcmp (ptr_start_regex, "*") != 0)
{
pos_tab = strstr (ptr_start_regex, "\\t");
@@ -299,7 +300,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
pos_regex_message = ptr_start_regex;
}
- if (regex_prefix)
+ if (regex_prefix && regex_prefix[0])
{
regex1 = malloc (sizeof (*regex1));
if (regex1)
@@ -314,18 +315,24 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
}
}
- regex2 = malloc (sizeof (*regex2));
- if (regex2)
+ if (pos_regex_message && pos_regex_message[0])
{
- if (string_regcomp (regex2, pos_regex_message,
- REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
+ regex2 = malloc (sizeof (*regex2));
+ if (regex2)
{
- if (regex_prefix)
- free (regex_prefix);
- if (regex1)
- free (regex1);
- free (regex2);
- return NULL;
+ if (string_regcomp (regex2, pos_regex_message,
+ REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
+ {
+ if (regex_prefix)
+ free (regex_prefix);
+ if (regex1)
+ {
+ regfree (regex1);
+ free (regex1);
+ }
+ free (regex2);
+ return NULL;
+ }
}
}