diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-24 10:14:10 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-24 10:14:10 +0100 |
commit | b932f403a55672c2f9f7a3188fa6d0d829faa356 (patch) | |
tree | f8c00a58e3a5ee1f8e7372819fa34d7a8aea4b47 /src | |
parent | 3e2943a0e0b6ec1f81849445cb5021028d526762 (diff) | |
download | weechat-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.c | 69 |
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)); } |