gbranden pushed a commit to branch master
in repository groff.

commit 75321a3ab4a779cc542c91cbc304b372774243f4
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Oct 4 01:33:20 2025 -0500

    [troff]: Add assertion.
    
    * src/roff/troff/env.cpp (environment::hyphenate_line): Add assertion
      for an apparently impossible scenario.  The formatter should not
      attempt to hyphenate an output line with no nodes in it.  An output
      line containing no nodes is nonsense.
---
 ChangeLog              | 7 +++++++
 src/roff/troff/env.cpp | 1 +
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0b8ed3b5b..6751b4937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-10-04  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp (environment::hyphenate_line): Add
+       assertion for an apparently impossible scenario.  The formatter
+       should not attempt to hyphenate an output line with no nodes in
+       it.  An output line containing no nodes is nonsense.
+
 2025-09-30  G. Branden Robinson <[email protected]>
 
        * tmac/an-ext.tmac: Tweak `EX`/`EE` behavior for more flexible
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index d9649211f..134f328a0 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2152,6 +2152,7 @@ void environment::hyphenate_line(bool must_break_here)
        break;
       prev_type = this_type;
     }
+  assert(*startp != 0 /* nullptr */);
   if (*startp == 0 /* nullptr */)
     return;
   node *tem = *startp;

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to