aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-08-08 20:57:05 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-08-08 20:57:05 +0200
commit9fc16a217d163196bb5b651e2dfbd80df54834ef (patch)
tree1b8c170d1a38e4829fbfb1e243ebfc619a931950
parent73a76cc9e51f9433e7540df454bc95e0e82357bf (diff)
weechat: Fix find_hdata_line_data_ptr
-rw-r--r--weechat/tomsg.c8
1 files 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;
}