From dbdc51696ef6424b90c46cabbe8fb8621a09250d Mon Sep 17 00:00:00 2001 From: david Date: Wed, 19 Mar 2003 01:59:02 +0000 Subject: [PATCH] Make sure fitted_in is always allocated, to avoid a segfault. --- src/Lib/Array/array.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Lib/Array/array.cxx b/src/Lib/Array/array.cxx index c2aa2fcf..822be173 100644 --- a/src/Lib/Array/array.cxx +++ b/src/Lib/Array/array.cxx @@ -91,15 +91,14 @@ bool TGArray::open( const string& file_base ) { // open array data file string array_name = file_base + ".arr.gz"; array_in = new sg_gzifstream( array_name ); + // open fitted data file + string fitted_name = file_base + ".fit.gz"; + fitted_in = new sg_gzifstream( fitted_name ); if ( ! array_in->is_open() ) { cout << " Cannot open " << array_name << endl; return false; } cout << " Opening array data file: " << array_name << endl; - - // open fitted data file - string fitted_name = file_base + ".fit.gz"; - fitted_in = new sg_gzifstream( fitted_name ); if ( ! fitted_in->is_open() ) { cout << " Cannot open " << fitted_name << endl; return false; @@ -251,7 +250,7 @@ TGArray::parse( SGBucket& b ) { } // Parse/load the array data file - if ( fitted_in->is_open() ) { + if ( fitted_in && fitted_in->is_open() ) { fit_on_the_fly = false; int fitted_size; double x, y, z, error;