aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-07-09 15:57:02 +0200
committerThomas White <taw@physics.org>2015-07-09 15:57:31 +0200
commit235e8eb20240af5266b064ee931bc6723004bf4d (patch)
tree5487935a1ef56926c63baa5bb98c63d8c9718d01
parentd80615db26ff88e3c925e58eeaa122dc7b818dd6 (diff)
Tidy up error handling when given dodgy data locations
-rw-r--r--libcrystfel/src/hdf5-file.c5
-rw-r--r--src/dw-hdfsee.c1
-rw-r--r--src/im-sandbox.c4
3 files changed, 9 insertions, 1 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 9953b3e0..c58a3ae5 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -2370,6 +2370,11 @@ struct event_list *fill_event_list(struct hdfile *hdfile, struct detector *det)
dh = H5Dopen2(hdfile->fh, full_panel_path,
H5P_DEFAULT);
+ if ( dh < 0 ) {
+ ERROR("Failed to enumerate events. "
+ "Check your geometry file.\n");
+ return NULL;
+ }
sh = H5Dget_space(dh);
dims = H5Sget_simple_extent_ndims(sh);
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 2549321c..5362bca7 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -2831,7 +2831,6 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
if ( dw->ev_list == NULL ) {
ERROR("Error while parsing file structure\n");
- free_event_list(dw->ev_list);
free(dw->geom_filename);
free(dw);
return NULL;
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 36150a1b..f796b8b7 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -222,6 +222,10 @@ static struct filename_plus_event *get_pattern(FILE *fh, int config_basename,
}
ev_list = fill_event_list(hdfile, det);
+ if ( ev_list == NULL ) {
+ ERROR("Failed to get event list.\n");
+ return NULL;
+ }
if ( ev_list->num_events == 0 ) {
event_index = -1;