summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-03-24 10:14:10 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-03-24 10:14:10 +0100
commitb932f403a55672c2f9f7a3188fa6d0d829faa356 (patch)
treef8c00a58e3a5ee1f8e7372819fa34d7a8aea4b47 /src
parent3e2943a0e0b6ec1f81849445cb5021028d526762 (diff)
downloadweechat-b932f403a55672c2f9f7a3188fa6d0d829faa356.zip
Fix crash on /upgrade if there are some nicks in a nicklist without prefix or prefix_color defined
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-bar-item.c69
1 files changed, 39 insertions, 30 deletions
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 4611b9bc0..64ee4ec9e 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -1187,31 +1187,37 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
strcat (buf, " ");
}
}
- if (strchr (ptr_nick->prefix_color, '.'))
+ if (ptr_nick->prefix_color)
{
- config_file_search_with_string (ptr_nick->prefix_color,
- NULL, NULL, &ptr_option,
- NULL);
- if (ptr_option)
- strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
- }
- else
- {
- strcat (buf, gui_color_get_custom (ptr_nick->prefix_color));
+ if (strchr (ptr_nick->prefix_color, '.'))
+ {
+ config_file_search_with_string (ptr_nick->prefix_color,
+ NULL, NULL, &ptr_option,
+ NULL);
+ if (ptr_option)
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
+ }
+ else
+ {
+ strcat (buf, gui_color_get_custom (ptr_nick->prefix_color));
+ }
}
if (ptr_nick->prefix)
strcat (buf, ptr_nick->prefix);
- if (strchr (ptr_nick->color, '.'))
- {
- config_file_search_with_string (ptr_nick->color,
- NULL, NULL, &ptr_option,
- NULL);
- if (ptr_option)
- strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
- }
- else
+ if (ptr_nick->color)
{
- strcat (buf, gui_color_get_custom (ptr_nick->color));
+ if (strchr (ptr_nick->color, '.'))
+ {
+ config_file_search_with_string (ptr_nick->color,
+ NULL, NULL, &ptr_option,
+ NULL);
+ if (ptr_option)
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
+ }
+ else
+ {
+ strcat (buf, gui_color_get_custom (ptr_nick->color));
+ }
}
strcat (buf, ptr_nick->name);
}
@@ -1221,17 +1227,20 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item,
{
strcat (buf, " ");
}
- if (strchr (ptr_group->color, '.'))
- {
- config_file_search_with_string (ptr_group->color,
- NULL, NULL, &ptr_option,
- NULL);
- if (ptr_option)
- strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
- }
- else
+ if (ptr_group->color)
{
- strcat (buf, gui_color_get_custom (ptr_group->color));
+ if (strchr (ptr_group->color, '.'))
+ {
+ config_file_search_with_string (ptr_group->color,
+ NULL, NULL, &ptr_option,
+ NULL);
+ if (ptr_option)
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(ptr_option))));
+ }
+ else
+ {
+ strcat (buf, gui_color_get_custom (ptr_group->color));
+ }
}
strcat (buf, gui_nicklist_get_group_start (ptr_group->name));
}