From 9fc16a217d163196bb5b651e2dfbd80df54834ef Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 8 Aug 2020 20:57:05 +0200 Subject: weechat: Fix find_hdata_line_data_ptr --- weechat/tomsg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/weechat/tomsg.c b/weechat/tomsg.c index bd01165..0895428 100644 --- a/weechat/tomsg.c +++ b/weechat/tomsg.c @@ -103,9 +103,10 @@ static struct t_gui_line_data* find_hdata_line_data_ptr(struct roomdata *room, i } struct t_gui_line *line_ptr = weechat_hdata_pointer(lines_h, lines_ptr, "last_line"); - struct t_gui_line_data *line_data_ptr; + int lines_count = weechat_hdata_integer(lines_h, lines_ptr, "lines_count"); + struct t_gui_line_data *line_data_ptr = NULL; - while (line_ptr) { + while (lines_count --> 0) { line_data_ptr = weechat_hdata_pointer(line_h, line_ptr, "data"); const int tags_count = weechat_hdata_integer(line_data_h, line_data_ptr, "tags_count"); @@ -125,10 +126,11 @@ static struct t_gui_line_data* find_hdata_line_data_ptr(struct roomdata *room, i if ((have_reply_tag || !must_be_reply) && have_msgid_tag) break; + line_data_ptr = NULL; line_ptr = weechat_hdata_pointer(line_h, line_ptr, "prev_line"); } - if (line_ptr) return line_data_ptr; + if (line_data_ptr) return line_data_ptr; else return NULL; } -- cgit v1.2.3-54-g00ecf