Commit 473d708f08016e9cce68bbbb2bc58542a7685c12

Authored by Jürgen Knödlseder
1 parent 90a9bcb5

Do not process an empty event file.

The processing for empty event files is skipped. The file is simply written out empty again.
Showing 1 changed file with 11 additions and 1 deletions
src/ctselect/ctselect.cpp
... ... @@ -268,6 +268,16 @@ void ctselect::run(void)
268 268 // Save event file name (for possible saving)
269 269 m_infiles[i] = obs->eventfile();
270 270  
  271 + // Fall through in case that the event file is empty
  272 + if (obs->events()->size() == 0) {
  273 + if (logTerse()) {
  274 + log << " Warning: No events in event file \"";
  275 + log << m_infiles[i] << "\". Event selection skipped.";
  276 + log << std::endl;
  277 + }
  278 + continue;
  279 + }
  280 +
271 281 // Get temporary file name
272 282 #if G_USE_MKSTEMP
273 283 char tpl[] = "ctselectXXXXXX";
... ... @@ -837,7 +847,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string&amp; filename)
837 847 int nevents = file.table("EVENTS")->nrows();
838 848  
839 849 // If the selected event list is empty or if removal of all events
840   - // has been requesten then append an empty event list to the observation.
  850 + // has been requested then append an empty event list to the observation.
841 851 if ((nevents < 1) || (remove_all)) {
842 852  
843 853 // Create empty event list
... ...