gbranden pushed a commit to branch master
in repository groff.
commit 3005a44d42ffd3dae1147ee7009faf7c9c67f452
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Oct 18 09:47:18 2026 -0500
[troff]: Fix Savannah #68794.
* src/roff/troff/env.cpp (environment_copy): Instead of throwing
assert(3)ion when given invalid environment identifier, perform no
operation.
Fixes <https://savannah.gnu.org/bugs/?68794>.
---
ChangeLog | 10 ++++++++++
src/roff/troff/env.cpp | 15 ++++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2b086c905..5709999ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-10-18 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68794.
+
+ * src/roff/troff/env.cpp (environment_copy): Instead of throwing
+ assert(3)ion when given invalid environment identifier, perform
+ no operation.
+
+ Fixes <https://savannah.gnu.org/bugs/?68794>.
+
2026-10-18 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68794.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 4e4b7b7f6..2476b6bb8 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3881,13 +3881,14 @@ static void environment_copy() // .evc
environment *e = 0 /* nullptr */;
tok.skip_spaces();
symbol nm = read_long_identifier();
- assert(nm != 0 /* nullptr */);
- e = static_cast<environment *>(env_dictionary.lookup(nm));
- if (e != 0 /* nullptr */)
- curenv->copy(e);
- else
- error("cannot copy from nonexistent environment '%1'",
- nm.contents());
+ if (!nm.is_null()) {
+ e = static_cast<environment *>(env_dictionary.lookup(nm));
+ if (e != 0 /* nullptr */)
+ curenv->copy(e);
+ else
+ error("cannot copy from nonexistent environment '%1'",
+ nm.contents());
+ }
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit