Fix a SIGSEGV when emitting XML or JSON when reading stdin. In that
case the file variable is NULL.
This commit is contained in:
parent
b78618fbda
commit
985c93f0b4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274210
@ -164,8 +164,6 @@ show_cnt(const char *file, uintmax_t linect, uintmax_t wordct,
|
||||
siginfo = 0;
|
||||
}
|
||||
|
||||
xo_emit("{ek:filename/%s}", file);
|
||||
|
||||
if (doline)
|
||||
xo_emit_h(xop, " {:lines/%7ju/%ju}", linect);
|
||||
if (doword)
|
||||
@ -175,7 +173,7 @@ show_cnt(const char *file, uintmax_t linect, uintmax_t wordct,
|
||||
if (dolongline)
|
||||
xo_emit_h(xop, " {:long-lines/%7ju/%ju}", llct);
|
||||
if (file != NULL)
|
||||
xo_emit_h(xop, " {d:filename/%s}\n", file);
|
||||
xo_emit_h(xop, " {:filename/%s}\n", file);
|
||||
else
|
||||
xo_emit_h(xop, "\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user