From 0a1613abe1d5ec9353001d68d6bb44bc64d97244 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 2 Oct 2008 12:46:57 -0400 Subject: Output: Verify output files are open after opening them. --- src/base/stats/text.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/base') diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc index 6f40d92c8..f65b77777 100644 --- a/src/base/stats/text.cc +++ b/src/base/stats/text.cc @@ -107,7 +107,8 @@ Text::open(std::ostream &_stream) mystream = false; stream = &_stream; - assert(valid()); + if (!valid()) + fatal("Unable to open output stream for writing\n"); } void @@ -118,13 +119,14 @@ Text::open(const std::string &file) mystream = true; stream = new ofstream(file.c_str(), ios::trunc); - assert(valid()); + if (!valid()) + fatal("Unable to open statistics file for writing\n"); } bool Text::valid() const { - return stream != NULL; + return stream != NULL && stream->good(); } void -- cgit v1.2.3