From 4e1aad6679648c6ec0ee4d436b03dec5684eac5e Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Fri, 5 Mar 2021 20:28:10 +0100 Subject: [PATCH] fix assertion failure when the line does not have text (yet) --- src/fe-text/textbuffer.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c index 8761507b..5a5ddf21 100644 --- a/src/fe-text/textbuffer.c +++ b/src/fe-text/textbuffer.c @@ -238,14 +238,15 @@ void textbuffer_line2text(TEXT_BUFFER_REC *buffer, LINE_REC *line, int coloring, g_string_truncate(str, 0); - ptr = textbuffer_line_get_text(buffer, line); - if (coloring == 0) { - tmp = ptr; - ptr = strip_codes(tmp); - g_free(tmp); + if ((ptr = textbuffer_line_get_text(buffer, line)) != NULL) { + if (coloring == 0) { + tmp = ptr; + ptr = strip_codes(tmp); + g_free(tmp); + } + g_string_append(str, ptr); + g_free(ptr); } - g_string_append(str, ptr); - g_free(ptr); } GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,