summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-12-20 18:22:22 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-12-20 18:22:22 +0100
commit8893a590631491766615f705057f4fd3ede5cfab (patch)
tree7838ea8307cf0af323849b6a289a2ec9bbaabf66
parentf7a3a2d995a4cbaed33e595dee5f7a7962b299c0 (diff)
downloadweechat-8893a590631491766615f705057f4fd3ede5cfab.zip
Build list of color aliases at startup (fix crash when setting "++1" on option if no palette option is defined)
-rw-r--r--src/gui/curses/gui-curses-color.c7
-rw-r--r--src/gui/gui-color.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index 5afc5d76b..cc08c02ac 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -448,6 +448,7 @@ gui_color_init ()
}
gui_color_init_pairs ();
gui_color_init_weechat ();
+ gui_color_palette_build_aliases ();
}
/*
@@ -562,6 +563,12 @@ gui_color_palette_build_aliases ()
{
int i;
+ if (!gui_color_hash_palette_alias || !gui_color_list_with_alias
+ || !gui_color_hash_palette_color)
+ {
+ gui_color_palette_alloc ();
+ }
+
hashtable_remove_all (gui_color_hash_palette_alias);
weelist_remove_all (gui_color_list_with_alias);
for (i = 0; i < GUI_CURSES_NUM_WEECHAT_COLORS; i++)
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 853fcd79d..5d199a67f 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -153,6 +153,7 @@ extern const char *gui_color_get_custom (const char *color_name);
extern char *gui_color_decode (const char *string, const char *replacement);
extern char *gui_color_string_replace_colors (const char *string);
extern void gui_color_free (struct t_gui_color *color);
+extern void gui_color_palette_alloc ();
extern int gui_color_palette_get_alias (const char *alias);
extern struct t_gui_color_palette *gui_color_palette_get (int number);
extern void gui_color_palette_add (int number, const char *value);