From dc3e933ec4b73ac93ae866bb979f02045181a17f Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 27 Jan 2015 09:19:41 +0000 Subject: fixed gtkut_text_buffer_insert_with_tag_by_name(). git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3462 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 5 +++++ src/gtkutils.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6c4cdb3a..85b6cf44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-01-16 + + * src/gtkutils.c: gtkut_text_buffer_insert_with_tag_by_name(): + guard against the case of len == 0 (#215). + 2015-01-16 * src/mainwindow.c: main_window_window_state_cb(): diff --git a/src/gtkutils.c b/src/gtkutils.c index 8240acc3..8258094d 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -965,7 +965,7 @@ void gtkut_text_buffer_insert_with_tag_by_name(GtkTextBuffer *buffer, gtk_text_buffer_insert_with_tags_by_name (buffer, iter, text, len, tag, NULL); - if (text[len - 1] != '\n') { + if (len > 0 && text[len - 1] != '\n') { /* somehow returns invalid value first (bug?), so call it twice */ gtk_text_iter_get_chars_in_line(iter); -- cgit v1.2.3