1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-07-02 11:29:36 +00:00

Don't write to the log stream if null

This prevents a somewhat vexing crash condition from happening.
This commit is contained in:
Peter Evans 2017-12-15 16:28:14 -06:00
parent 7811f4da44
commit 256e0cf1d6

View File

@ -62,6 +62,12 @@ log_write(int level, const char *fmt, ...)
{
va_list ap;
// Oh. Well, we can't write something if we have no log stream,
// right?
if (log_stream == NULL) {
return;
}
va_start(ap, fmt);
vfprintf(log_stream, fmt, ap);
fprintf(log_stream, "\n");