summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-10-29 23:21:57 +0200
committerSebastien Helleu <flashcode@flashtux.org>2010-10-29 23:21:57 +0200
commit90c99339b486ebf5d587e33e0d9d406deac9ea2d (patch)
treeba6aaa75dcc36f16ee6e25ad2407ac1c739b4be6 /src/gui
parent804551122a3f56d623485e66c6b2188e6a784fab (diff)
downloadweechat-90c99339b486ebf5d587e33e0d9d406deac9ea2d.zip
Return empty string in API function weechat_color when color is unknown
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-color.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index f053ced2e..5e170d214 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -208,23 +208,32 @@ gui_color_get_custom (const char *color_name)
{
fg = gui_color_search (str_fg);
bg = gui_color_search (pos_bg);
- snprintf (color[index_color], sizeof (color[index_color]),
- "%s*%02d,%02d",
- GUI_COLOR_COLOR_STR, fg, bg);
+ if ((fg >= 0) && (bg >= 0))
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%s*%02d,%02d",
+ GUI_COLOR_COLOR_STR, fg, bg);
+ }
}
else if (str_fg && !pos_bg)
{
fg = gui_color_search (str_fg);
- snprintf (color[index_color], sizeof (color[index_color]),
- "%sF%02d",
- GUI_COLOR_COLOR_STR, fg);
+ if (fg >= 0)
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%sF%02d",
+ GUI_COLOR_COLOR_STR, fg);
+ }
}
else if (!str_fg && pos_bg)
{
bg = gui_color_search (pos_bg);
- snprintf (color[index_color], sizeof (color[index_color]),
- "%sB%02d",
- GUI_COLOR_COLOR_STR, bg);
+ if (bg >= 0)
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%sB%02d",
+ GUI_COLOR_COLOR_STR, bg);
+ }
}
if (str_fg)