From b483a4e696e3cf838a9194ef21f8caab5e8eb54b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 10 Sep 2019 15:29:00 +0200 Subject: sort_peaks(): Handle NULL peak list --- libcrystfel/src/image.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libcrystfel') 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)); -- cgit v1.2.3