Commit 6ba1e9b5b2092b678fd4dacb3d44c41a82c27cf2

Authored by Jürgen Knödlseder
1 parent f216e606

Dispose event files only if they exist on disk.

Showing 1 changed file with 5 additions and 2 deletions
src/ctmodel/ctmodel.cpp
@@ -273,8 +273,11 @@ void ctmodel::run(void) @@ -273,8 +273,11 @@ void ctmodel::run(void)
273 // Fill the cube 273 // Fill the cube
274 fill_cube(obs); 274 fill_cube(obs);
275 275
276 - // Dispose events to free memory  
277 - obs->dispose_events(); 276 + // Dispose events to free memory if event file exists on disk
  277 + if (obs->eventfile().length() > 0 &&
  278 + gammalib::file_exists(obs->eventfile())) {
  279 + obs->dispose_events();
  280 + }
278 281
279 } // endif: CTA observation found 282 } // endif: CTA observation found
280 283