gbranden pushed a commit to branch master
in repository groff.

commit 9a80deb3f15172a845d45421e65f8706b459cfc9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Nov 20 00:09:26 2025 -0600

    src/roff/troff/input.cpp: Add assertions (3/10).
    
    * src/roff/troff/input.cpp (token::next): Add assertions to `\z` escape
      sequence handler.
---
 ChangeLog                |  1 +
 src/roff/troff/input.cpp | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 91ea5538d..f459642ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * src/roff/troff/input.cpp (do_overstrike, do_bracket): Invert
        sense of test and add assertion.
+       (token::next): Add assertions to `\z` escape sequence handler.
 
 2025-11-21  G. Branden Robinson <[email protected]>
 
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index f709c25bf..74eaa716f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2650,11 +2650,17 @@ void token::next()
            nd = new zero_width_node(nd);
          else {
            charinfo *ci = get_charinfo(true /* required */);
-           if (0 /* nullptr */ == ci)
+           if (0 /* nullptr */ == ci) {
+             assert(0 == "attempted to use token without charinfo in"
+                    " zero-width escape sequence");
              break;
+           }
            node *gn = curenv->make_char_node(ci);
-           if (0 /* nullptr */ == gn)
+           if (0 /* nullptr */ == gn) {
+             assert("make_char_node failed to create a character"
+                    " node");
              break;
+           }
            nd = new zero_width_node(gn);
            type = TOKEN_NODE;
          }

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

Reply via email to