diff options
| -rw-r--r-- | weechat/tomsg.c | 8 | 
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;  } | 
