gbranden pushed a commit to branch master
in repository groff.

commit 1a0741556c471d1de259053d4b6a60c576bac521
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Nov 20 00:01:22 2025 -0600

    src/roff/troff/input.cpp: Add assertion (2/10).
    
    * src/roff/troff/input.cpp (do_bracket): Invert sense of test and add
      assertion.
---
 ChangeLog                |  4 ++--
 src/roff/troff/input.cpp | 12 +++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d058a0c78..91ea5538d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 2025-11-19  G. Branden Robinson <[email protected]>
 
-       * src/roff/troff/input.cpp (do_overstrike): Invert sense of test
-       and add assertion.
+       * src/roff/troff/input.cpp (do_overstrike, do_bracket): Invert
+       sense of test and add assertion.
 
 2025-11-21  G. Branden Robinson <[email protected]>
 
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 95cb032ab..f709c25bf 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1726,9 +1726,15 @@ static node *do_bracket() // \b
        && (want_att_compat || input_stack::get_level() == start_level))
       break;
     charinfo *ci = tok.get_charinfo(true /* required */);
-    if (ci != 0 /* nullptr */) {
-      node *n = curenv->make_char_node(ci);
-      if (n != 0 /* nullptr */)
+    if (0 /* nullptr */ == ci) {
+      assert(0 == "attempted to use token without charinfo in"
+            " bracket-building escape sequence");
+      delete bracketnode;
+      return 0 /* nullptr */;
+    }
+    else {
+       node *n = curenv->make_char_node(ci);
+       if (n != 0 /* nullptr */)
        bracketnode->bracket(n);
     }
   }

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

Reply via email to