summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-02-05 21:55:58 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-02-05 21:55:58 +0100
commit96de4e8746449b0e6694cf4a46f23550faec0dd3 (patch)
treea13ab8bdeff15952d7f8e6436cac84f533823f83
parentb1c8989835499c52677b092044f91da9d769e597 (diff)
downloadweechat-96de4e8746449b0e6694cf4a46f23550faec0dd3.zip
Fix infinite loop when option weechat.look.read_marker_string it set to empty string
-rw-r--r--src/gui/curses/gui-curses-chat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index c9e12b370..a10672e9e 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -134,12 +134,16 @@ void
gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate)
{
int x, size_on_screen;
+ char *read_marker_string, *default_string = "- ";
if (!simulate)
{
if (CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_LINE)
{
- size_on_screen = utf8_strlen_screen (CONFIG_STRING(config_look_read_marker_string));
+ read_marker_string = CONFIG_STRING(config_look_read_marker_string);
+ if (!read_marker_string || !read_marker_string[0])
+ read_marker_string = default_string;
+ size_on_screen = utf8_strlen_screen (read_marker_string);
gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_chat,
GUI_COLOR_CHAT_READ_MARKER);
wmove (GUI_WINDOW_OBJECTS(window)->win_chat,
@@ -150,7 +154,7 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate)
{
mvwprintw (GUI_WINDOW_OBJECTS(window)->win_chat,
window->win_chat_cursor_y, x,
- "%s", CONFIG_STRING(config_look_read_marker_string));
+ "%s", read_marker_string);
x += size_on_screen;
}
}