check and make sure there's a stream to write to, before trying to
write.  program won't crash now.