Index: cgi.c =================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.181 diff -u -r1.181 cgi.c --- cgi.c 28 Apr 2023 19:11:03 -0000 1.181 +++ cgi.c 13 Oct 2023 07:28:40 -0000 @@ -919,6 +919,8 @@ mparse_readfd(mp, fd, file); close(fd); meta = mparse_result(mp); + if (meta == NULL) + return; memset(&conf, 0, sizeof(conf)); conf.fragment = 1; Index: demandoc.c =================================================================== RCS file: /cvs/mandoc/demandoc.c,v retrieving revision 1.34 diff -u -r1.34 demandoc.c --- demandoc.c 14 Apr 2022 16:43:43 -0000 1.34 +++ demandoc.c 13 Oct 2023 07:28:40 -0000 @@ -127,6 +127,8 @@ mparse_readfd(mp, fd, fn); close(fd); meta = mparse_result(mp); + if (meta == NULL) + return; line = 1; col = 0; Index: main.c =================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.361 diff -u -r1.361 main.c --- main.c 14 Apr 2022 16:43:43 -0000 1.361 +++ main.c 13 Oct 2023 07:28:41 -0000 @@ -983,6 +983,8 @@ mandoc_xr_reset(); meta = mparse_result(mp); + if (meta == NULL) + return; /* Execute the out device, if it exists. */ Index: mandocd.c =================================================================== RCS file: /cvs/mandoc/mandocd.c,v retrieving revision 1.13 diff -u -r1.13 mandocd.c --- mandocd.c 14 Apr 2022 16:43:44 -0000 1.13 +++ mandocd.c 13 Oct 2023 07:28:41 -0000 @@ -261,6 +261,8 @@ mparse_readfd(parser, STDIN_FILENO, ""); meta = mparse_result(parser); + if (meta == NULL) + return; if (meta->macroset == MACROSET_MDOC) { switch (outtype) { case OUTT_ASCII: Index: read.c =================================================================== RCS file: /cvs/mandoc/read.c,v retrieving revision 1.221 diff -u -r1.221 read.c --- read.c 19 May 2022 14:48:56 -0000 1.221 +++ read.c 13 Oct 2023 07:28:41 -0000 @@ -716,6 +716,8 @@ struct roff_meta * mparse_result(struct mparse *curp) { + if (curp->line == 0) + return (NULL); roff_state_reset(curp->man); if (curp->options & MPARSE_VALIDATE) { if (curp->man->meta.macroset == MACROSET_MDOC)