diff options
-rw-r--r-- | libcrystfel/src/events.c | 2 | ||||
-rw-r--r-- | src/dw-hdfsee.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c index d40d2021..b008eee6 100644 --- a/libcrystfel/src/events.c +++ b/libcrystfel/src/events.c @@ -239,6 +239,8 @@ int find_event(struct event *ev, struct event_list *el) { int i; + if ( ev == NULL ) return el->num_events; + for ( i=0; i<el->num_events; i++ ) { if ( events_equal(ev, el->events[i]) ) return i; } diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index 78f691b6..72e3b435 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -2546,6 +2546,11 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename, if ( event != NULL ) { ev = get_event_from_event_string(event); dw->curr_event = find_event(ev, dw->ev_list); + if ( dw->curr_event == dw->ev_list->num_events) + { + ERROR("Invalid event\n"); + return NULL; + } } else { dw->curr_event = 0; ev = dw->ev_list->events[dw->curr_event]; |