aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-09-10 15:29:00 +0200
committerThomas White <taw@physics.org>2019-09-10 16:39:13 +0200
commitb483a4e696e3cf838a9194ef21f8caab5e8eb54b (patch)
treead7d45c60369833b96dc36ef8183fb4afe358980
parent7d2966b89351f3464802ee1691d1c8a8d47d2ae8 (diff)
sort_peaks(): Handle NULL peak list
-rw-r--r--libcrystfel/src/image.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 44ef2774..7c04d7f7 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -112,9 +112,12 @@ static int comp(const void *a, const void *b)
*/
ImageFeatureList *sort_peaks(ImageFeatureList *flist)
{
- ImageFeatureList *n = image_feature_list_new();
+ ImageFeatureList *n;
int nf, i;
+ if ( flist == NULL ) return NULL;
+
+ n = image_feature_list_new();
if ( n == NULL ) return NULL;
n->features = malloc(flist->n_features*sizeof(struct imagefeature));