energy average printing segfaults when no data sets are recorded - Redmine #2394
If no calcenergy steps have added data to mdebin, the printing divides by zero when computing the averages. That’s unlikely to be a problem in practice. *(from redmine: issue id 2394, created on 2018-01-31 by mark.j.abraham, closed on 2018-02-06)* * Changesets: * Revision fb33d1ced794c511839d21ed3444325d2db9b728 by Mark Abraham on 2018-02-06T15:27:57Z: ``` Prevent log file energy average printing dividing by zero If there's not enough data for averages, skip the average printing entirely. In principle, pr_ebin could be called from elsewhere than print_ebin, so now we print "N/A" rather than "nan" or segfaulting. Added some const correctness. Added some tests. Unfortunately they currently have to write a file to disk, but we should have the test before refactoring it to run in memory. The tests needed to be able to clean up their memory, so runner can now also call done_ebin but for stability we'll leave that off for now. TODO When merging to master branch enable the call to done_ebin in runner(). Fixes #2394 Change-Id: Id2e151664dd4553e49880f96bdd90aacc945f992 ```
issue