diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/gencat/genlib.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/gencat/genlib.c b/usr.bin/gencat/genlib.c index e1a55bf..185f2a0 100644 --- a/usr.bin/gencat/genlib.c +++ b/usr.bin/gencat/genlib.c @@ -49,7 +49,7 @@ static long lineno = 0; static void warning(char *cptr, const char *msg) { - warnx("%s on line %ld\n%s", msg, lineno, curline); + warnx("%s on line %ld\n%s", msg, lineno, (curline == NULL ? "" : curline) ); if (cptr) { char *tptr; for (tptr = curline; tptr < cptr; ++tptr) putc(' ', stderr); @@ -559,6 +559,9 @@ MCWriteCat(int fd) mcHead.flags = MCGetByteOrder(); mcHead.firstSet = 0; /* We'll be back to set this in a minute */ + if (cat == NULL) + error(NULL, "cannot write empty catalog set"); + for (cnt = 0, set = cat->first; set; set = set->next) ++cnt; mcHead.numSets = cnt; |