From 0509e8ad099a0e6755b7667b067c8c9303348ec8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 2 Oct 2012 16:11:09 +0200 Subject: Fix segfault on failed indexing --- libcrystfel/src/cell-utils.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index 3aaae90e..ae06774a 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -683,13 +683,21 @@ UnitCell *match_cell(UnitCell *cell_in, UnitCell *template_in, int verbose, free(cand[2]); /* Reverse the de-centering transformation */ - new_cell_trans = cell_transform_inverse(new_cell, uncentering); - cell_free(new_cell); - cell_set_lattice_type(new_cell, cell_get_lattice_type(template_in)); - cell_set_centering(new_cell, cell_get_centering(template_in)); - cell_set_unique_axis(new_cell, cell_get_unique_axis(template_in)); + if ( new_cell != NULL ) { - return new_cell_trans; + new_cell_trans = cell_transform_inverse(new_cell, uncentering); + cell_free(new_cell); + cell_set_lattice_type(new_cell, + cell_get_lattice_type(template_in)); + cell_set_centering(new_cell, cell_get_centering(template_in)); + cell_set_unique_axis(new_cell, + cell_get_unique_axis(template_in)); + + return new_cell_trans; + + } else { + return NULL; + } } -- cgit v1.2.3 From d9145ab07fec3ca5cc0230337c6fde37c15ead4e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 2 Oct 2012 16:11:22 +0200 Subject: Use the correct panel number --- libcrystfel/src/peaks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index f7f6c650..b0b48c2e 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -771,7 +771,7 @@ void integrate_reflections(struct image *image, int use_closer, int bgsub, r = integrate_peak(image, pfs, pss, &fs, &ss, &intensity, &sigma, ir_inn, ir_mid, ir_out, - 1, bgMasks[j]); + 1, bgMasks[pnum]); /* I/sigma(I) cutoff */ if ( intensity/sigma < min_snr ) r = 1; -- cgit v1.2.3 From c99176cca2d92dd0a2afa20de1a0a4b1feea6f7c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 2 Oct 2012 16:35:29 +0200 Subject: Fix obvious bug --- libcrystfel/src/cell-utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index ae06774a..74f33bb2 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -687,10 +687,11 @@ UnitCell *match_cell(UnitCell *cell_in, UnitCell *template_in, int verbose, new_cell_trans = cell_transform_inverse(new_cell, uncentering); cell_free(new_cell); - cell_set_lattice_type(new_cell, + cell_set_lattice_type(new_cell_trans, cell_get_lattice_type(template_in)); - cell_set_centering(new_cell, cell_get_centering(template_in)); - cell_set_unique_axis(new_cell, + cell_set_centering(new_cell_trans, + cell_get_centering(template_in)); + cell_set_unique_axis(new_cell_trans, cell_get_unique_axis(template_in)); return new_cell_trans; -- cgit v1.2.3