diff options
author | Ken Beyerlein <kenneth.beyerlein@desy.de> | 2016-02-03 15:54:54 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2016-02-05 14:46:55 +0100 |
commit | 0872486795f6235180a133a5ce89e7c98aa02107 (patch) | |
tree | b37d1f3692fef60e6bbc2da0abf0afa99fd691da /libcrystfel/src/felix.c | |
parent | c2c84f9f8051e1e3bd0d40dcd88677513b830120 (diff) |
felix: fix seg fault
Diffstat (limited to 'libcrystfel/src/felix.c')
-rw-r--r-- | libcrystfel/src/felix.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/libcrystfel/src/felix.c b/libcrystfel/src/felix.c index 8a978957..02d523c6 100644 --- a/libcrystfel/src/felix.c +++ b/libcrystfel/src/felix.c @@ -133,13 +133,13 @@ static int read_felix(struct felix_private *gp, struct image *image, fh = fopen(filename, "r"); if ( fh == NULL ) { ERROR("Can't open '%s'\n", filename); - return 1; + return 0; } /* Read and discard first line */ if ( fgets( line, 1024, fh ) == NULL ) { ERROR("Failed to read *.felix file.\n"); - return 1; + return 0; } do { @@ -180,7 +180,7 @@ static int read_felix(struct felix_private *gp, struct image *image, if ( r != 21 ) { ERROR("Only %i parameters in .felix file, " "check version and format.\n", r); - return 1; + return -1; } cell = cell_new(); @@ -231,7 +231,7 @@ static int read_felix(struct felix_private *gp, struct image *image, } } - return n_crystals; + return n_crystals; } @@ -545,14 +545,10 @@ int felix_index(struct image *image, IndexingPrivate *ipriv) return 0; } - if ( read_felix(gp, image, gff_filename) != 0 ) { - free(felix); - return 0; - } + rval = read_felix(gp, image, gff_filename); - /* Success! */ free(felix); - return 1; + return rval; } |