ascii: Fix assertion in ascii_output_table_item().
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 26 Nov 2018 00:56:02 +0000 (16:56 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 26 Nov 2018 06:12:37 +0000 (22:12 -0800)
The previous assertion did not actually detect the bug it was intended to
cover.

src/output/ascii.c

index db75e69630e2feb4bf5ebf3021c0263bb89c423c..897182d04303b70aea89d370ac5d40e21f4c28b4 100644 (file)
@@ -463,7 +463,12 @@ ascii_output_table_item (struct ascii_driver *a,
       used = render_pager_draw_next (p, a->length - a->y);
       if (used == 0)
         {
-          assert (a->y >= 0);
+          /* Make sure that we're not in a loop where the table we're rendering
+             can't be broken to fit on a page.  (The check on
+             render_pager_has_next() allows for objects that turn out to be
+             empty when we try to render them.)  */
+          assert (a->y > 0 || !render_pager_has_next (p));
+
           ascii_close_page (a);
           if (!ascii_open_page (a))
             break;