diff options
author | Richard A. Kirian <rkirian@asu.edu> | 2011-11-29 13:54:08 -0800 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:42 +0100 |
commit | b509b608b5d22a06d618f011eaae0c4ab6c8e610 (patch) | |
tree | a1d0f083021269b1b47e2ef87ab8021e93d7a701 /src | |
parent | 220f6796e49dc842750d674b744f0f00129ada05 (diff) |
Fix possible seg fault in powder_plot
Diffstat (limited to 'src')
-rw-r--r-- | src/powder_plot.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/powder_plot.c b/src/powder_plot.c index d31ce59c..bb3ace9e 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -884,7 +884,15 @@ int main(int argc, char *argv[]) } - if ( is_stream(filename) ) { + + /* need to check that the file even exists before moving on */ + FILE * junk = fopen(filename,"r"); + if ( junk == NULL ) { + ERROR("The file %s does not exist!\n",filename); + exit(1); + } + + if ( is_stream(filename) == 1 ) { file_type = FILE_STREAM; fh = fopen(filename, "r"); |