gbranden pushed a commit to branch master
in repository groff.

commit af5d597aa2a19784cd378794100b0127998f3a71
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Mon May 19 21:38:39 2025 -0500

    [troff]: Add assertions.
    
    * src/roff/troff/node.cpp (dump_node_list, dump_node_list_in_reverse):
      Add assertions.  These functions should never be passed null pointers.
---
 ChangeLog               | 6 ++++++
 src/roff/troff/node.cpp | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 1fde33ec4..b95c60bad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-05-19  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/node.cpp (dump_node_list)
+       (dump_node_list_in_reverse): Add assertions.  These functions
+       should never be passed null pointers.
+
 2025-05-19  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/div.cpp (do_divert): Fix code style nit.
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 8be62a63c..41f99ea10 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2540,6 +2540,7 @@ void delete_node_list(node *n)
 
 void dump_node_list(node *n)
 {
+  assert(n != 0 /* nullptr */);
   bool need_comma = false;
   fputc('[', stderr);
   while (n != 0 /* nullptr */) {
@@ -2792,6 +2793,7 @@ void container_node::dump_node()
 
 void dump_node_list_in_reverse(node *nlist)
 {
+  assert(nlist != 0 /* nullptr */);
   // It's stored in reverse order already; this puts it forward again.
   std::stack<node *> reversed_node_list;
   node *n = nlist;

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to