1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

script: don't try to display the old line if it's NULL

This fixes a crash which would happen if you scrolled the script buffer
and then did a search which got fewer search results than the index of
the selected line before the search. E.g. press page down to go to the
second page and then search for `test`.
This commit is contained in:
Trygve Aaberge
2024-11-25 22:27:40 +01:00
committed by Sébastien Helleu
parent 48a92276e5
commit a0b7220d23
+5 -2
View File
@@ -818,14 +818,17 @@ void
script_buffer_set_current_line (int line)
{
int old_line;
struct t_script_repo *old_script;
if ((line >= 0) && (line < script_repo_count_displayed))
{
old_line = script_buffer_selected_line;
script_buffer_selected_line = line;
script_buffer_display_line_script (old_line,
script_repo_search_displayed_by_number (old_line));
old_script = script_repo_search_displayed_by_number (old_line);
if (old_script)
script_buffer_display_line_script (old_line, old_script);
script_buffer_display_line_script (script_buffer_selected_line,
script_repo_search_displayed_by_number (script_buffer_selected_line));
}