justify: correctly compute the number of lines to take, to avoid a crash

When the file starts with one or more blank lines, the first paragraph
doesn't start on line 1.

This fixes https://savannah.gnu.org/bugs/?56117.

Bug existed since version 4.0, commit ac8bd2a2.
master
Benno Schulenberg 2019-04-11 15:25:44 +02:00
parent 98cc39e8e5
commit d83a8eb359
1 changed files with 1 additions and 1 deletions

View File

@ -2070,7 +2070,7 @@ void do_justify(bool full_justify)
/* Set the number of lines to be pulled into the cutbuffer. */
if (full_justify)
jus_len = openfile->filebot->lineno;
jus_len = openfile->filebot->lineno - first_par_line->lineno + 1;
else
jus_len = par_len;