aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-04-27 13:46:41 +0200
committerThomas White <taw@physics.org>2018-04-27 13:46:41 +0200
commita886ab11bb7a316f56242dc190da008611f31871 (patch)
treeb9317991d95637fb662bfc54b20eec4d81d9fea3
parent3060d089df6730be78e50949eda5e728959c997d (diff)
copy_event/free_event: Handle NULL event
-rw-r--r--libcrystfel/src/events.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c
index 8e4eb861..d0e521d3 100644
--- a/libcrystfel/src/events.c
+++ b/libcrystfel/src/events.c
@@ -150,6 +150,8 @@ struct event *copy_event(struct event *ev)
struct event *new_ev;
int pi, di;
+ if ( ev == NULL ) return NULL;
+
if ( ev->dim_length == 0 && ev->path_length == 0) {
new_ev = initialize_event();
@@ -252,6 +254,8 @@ void free_event(struct event *ev)
{
int pi;
+ if ( ev == NULL ) return;
+
if ( ev->path_length != 0 ) {
for ( pi=0; pi<ev->path_length; pi++ ) {
free(ev->path_entries[pi]);