summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-08-24 09:12:06 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-08-24 09:12:06 +0200
commit2b8aa56917ca63448b43f44cc23f2f36aa7918e8 (patch)
treebe4fdd3454bd5b4ff32002a6556acbf40628ca8d /src/gui
parentb009f29021a020c2544330992f76e1fc600705a1 (diff)
downloadweechat-2b8aa56917ca63448b43f44cc23f2f36aa7918e8.zip
Fix crash with filters and day change lines
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-chat.c3
-rw-r--r--src/gui/gui-color.c14
2 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 87fde2fe1..5f3f136d1 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -532,7 +532,8 @@ gui_chat_line_match_regex (struct t_gui_line *line, regex_t *regex_prefix,
match_prefix = 1;
match_message = 1;
- prefix = (char *)gui_color_decode ((unsigned char *)line->prefix);
+ prefix = (line->prefix) ?
+ (char *)gui_color_decode ((unsigned char *)line->prefix) : NULL;
if (prefix && regex_prefix)
{
if (regexec (regex_prefix, prefix, 0, NULL, 0) != 0)
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index 6b5db98f2..dc77acaa9 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -235,6 +235,9 @@ gui_color_decode (const unsigned char *string)
unsigned char *out;
int out_length, out_pos, length;
+ if (!string)
+ return NULL;
+
out_length = (strlen ((char *)string) * 2) + 1;
out = malloc (out_length);
if (!out)
@@ -294,8 +297,11 @@ gui_color_decode (const unsigned char *string)
void
gui_color_free (struct t_gui_color *color)
{
- if (color->string)
- free (color->string);
-
- free (color);
+ if (color)
+ {
+ if (color->string)
+ free (color->string);
+
+ free (color);
+ }
}