Fix a SIGSEGV when emitting XML or JSON when reading stdin. In that
case the file variable is NULL.