Universite-Gustave-Eiffel / I-Simpa

An Open Source software for 3D sound propagation modelling
https://i-simpa.univ-gustave-eiffel.fr/
GNU General Public License v3.0
227 stars 56 forks source link

Bugfix: Fix segfault when trying to write to unopened particles collision statistics CSV files #383

Closed tonelli-m closed 2 months ago

tonelli-m commented 2 months ago

There are optional config options to disable writing particle collision statistics CSV files (save_surface_intersection for particle_surface_collision_statistics.csv and save_receivers_intersection for particle_receivers_collision_statistics.csv), but setting those properties to 0 make the program crash with Segmentation Fault because it still tries to write the CSV header even if the file wasn't opened because the option was disabled.

This PR simply moves writing the CSV header to the conditional blocks where the files are opened.


Steps to reproduce: