From f4337fa40220f7c67ff1fd3ad3cf2348916a7ba9 Mon Sep 17 00:00:00 2001
From: Stuart Mcalpine <s.r.mcalpine@durham.ac.uk>
Date: Wed, 31 Jul 2019 12:13:26 +0100
Subject: [PATCH] Updated logic check for doing a snapshot on the last timestep
 to remove repitition

---
 examples/main.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/examples/main.c b/examples/main.c
index 4be1384a1a..758ebcbdfd 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1300,8 +1300,8 @@ int main(int argc, char *argv[]) {
 #endif
 
     /* Write final snapshot? */
-    if (e.output_list_snapshots) {
-      if (e.output_list_snapshots->final_step_dump) {
+    if ((e.output_list_snapshots && e.output_list_snapshots->final_step_dump)
+        || !e.output_list_snapshots) {
 #ifdef HAVE_VELOCIRAPTOR
         if (with_structure_finding && e.snapshot_invoke_stf)
           velociraptor_invoke(&e, /*linked_with_snap=*/1);
@@ -1311,17 +1311,6 @@ int main(int argc, char *argv[]) {
         if (with_structure_finding && e.snapshot_invoke_stf)
           free(e.s->gpart_group_data);
 #endif
-      }
-    } else {
-#ifdef HAVE_VELOCIRAPTOR
-        if (with_structure_finding && e.snapshot_invoke_stf)
-          velociraptor_invoke(&e, /*linked_with_snap=*/1);
-#endif
-        engine_dump_snapshot(&e);
-#ifdef HAVE_VELOCIRAPTOR
-        if (with_structure_finding && e.snapshot_invoke_stf)
-          free(e.s->gpart_group_data);
-#endif 
     }
 
     /* Write final stf? */
-- 
GitLab