From 05be0289256ba4bd1cce6039b7aae22caa4fc240 Mon Sep 17 00:00:00 2001 From: "Richard A. Kirian" Date: Fri, 2 Dec 2011 09:49:47 -0800 Subject: Properly fix seg fault in powder_plot.c (Correction to commit 7543dfc55966d) --- libcrystfel/src/stream.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src/stream.c') diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index a7cdc2d9..ce948109 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -472,6 +472,9 @@ int is_stream(const char *filename) { char line[1024]; char *rval = NULL; fh = fopen(filename, "r"); + if ( fh == NULL ) { + return -1; + } rval = fgets(line, 1023, fh); fclose(fh); if ( rval == NULL ) { @@ -483,5 +486,4 @@ int is_stream(const char *filename) { else { return 0; } - return -1; } -- cgit v1.2.3