* Don't SEGFAULT on attempt to write nothing (if no source files were
specified) * Don't print currline if it's NULL MFC after: 3 days
This commit is contained in:
parent
1603684d77
commit
e0c90a7bd5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90609
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user