diff --git a/ChangeLog b/ChangeLog
index c47f58fdee0e09bdbd9cfb9577ed17d28d10455f..52d202ee351749dce185a104c60fa516536d9b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -211,6 +211,10 @@ CVS code -
 	  as the reset_cursor() called by edit_refresh() after restoring
 	  edittop and current will ensure that current_y is restored to
 	  its original value. (DLR)
+	- Renumber after justifying each individual paragraph, since
+	  find_paragraph() needs the line numbers to be right as well as
+	  edit_refresh().  This fixes a potential segfault when doing
+	  full justify with auto-indent turned on. (DLR)
   do_alt_speller()
 	- Move the code that replaces the text of the current file with
 	  the text of the spell-checked file into its own function,
diff --git a/src/text.c b/src/text.c
index 335aeb70e73926f6787f88d8ecc8f6c54dafe421..91b0a91b67fb09aafce16e39c44b731bcca359c8 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1448,22 +1448,25 @@ void do_justify(bool full_justify)
 	} else
 	    openfile->current_x = strlen(openfile->current->data);
 
-	/* We've just justified a paragraph. If we're not justifying the
-	 * entire file, break out of the loop.  Otherwise, continue the
-	 * loop so that we justify all the paragraphs in the file. */
+	/* Renumber the lines of the now-justified paragraph, since both
+	 * find_paragraph() and edit_refresh() need the line numbers to
+	 * be right. */
+	renumber(first_par_line);
+
+	/* We've just finished justifying the paragraph.  If we're not
+	 * justifying the entire file, break out of the loop.
+	 * Otherwise, continue the loop so that we justify all the
+	 * paragraphs in the file. */
 	if (!full_justify)
 	    break;
     }
 
     /* We are now done justifying the paragraph or the file, so clean
      * up.  current_y and totsize have been maintained above.  If we
-     * actually justified something, renumber, since edit_refresh()
-     * needs the line numbers to be right, and set last_par_line to the
-     * new end of the paragraph. */
-    if (first_par_line != NULL) {
-	renumber(first_par_line);
+     * actually justified something, set last_par_line to the new end of
+     * the paragraph. */
+    if (first_par_line != NULL)
 	last_par_line = openfile->current;
-    }
 
     edit_refresh();