1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Avoid segfault.

Go to the page with a few lines. Follow a link to a page with more lines.
Move cursor down, do not stay on a link.
Go back and do move-link-prev-line. This caused a segmentation fault.
(cherry picked from commit 888ba87516)
(cherry picked from commit 1cbd02c141)
This commit is contained in:
Witold Filipczyk 2007-08-14 20:43:22 +02:00 committed by Kalle Olavi Niemitalo
parent d830833e62
commit a282a98d4a

View File

@ -189,8 +189,8 @@ move_link_prev_line(struct session *ses, struct document_view *doc_view)
get_link_x_bounds(link, y1, &min_x, &max_x);
} else {
min_x = max_x = x1;
int_upper_bound(&y, document->height - 1);
}
int_upper_bound(&y, document->height - 1);
for (; y >= 0; y--, min_x = INT_MAX) {
link = document->lines1[y];
@ -238,8 +238,8 @@ move_link_next_line(struct session *ses, struct document_view *doc_view)
get_link_x_bounds(link, y1, &min_x, &max_x);
} else {
min_x = max_x = x1;
int_upper_bound(&y, document->height - 1);
}
int_upper_bound(&y, document->height - 1);
for (; y < document->height; y++, min_x = -1) {
link = document->lines1[y];