From 0003bb6766d79e87fb18bb9e7bbf0c7a0c1f7e49 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Fri, 23 Feb 2018 14:20:39 +0100
Subject: [PATCH] merge capture regions, so the library interface code can
 compiled with exceptions

---
 src/library.cpp | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/library.cpp b/src/library.cpp
index 0544aa5a4a..f0bd7f7ca6 100644
--- a/src/library.cpp
+++ b/src/library.cpp
@@ -276,13 +276,6 @@ void lammps_commands_string(void *ptr, char *str)
 {
   LAMMPS *lmp = (LAMMPS *) ptr;
 
-  BEGIN_CAPTURE
-  {
-    if (lmp->update->whichflag != 0)
-      lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run");
-  }
-  END_CAPTURE
-
   // make copy of str so can strtok() it
 
   int n = strlen(str) + 1;
@@ -291,6 +284,11 @@ void lammps_commands_string(void *ptr, char *str)
 
   BEGIN_CAPTURE
   {
+    if (lmp->update->whichflag != 0) {
+      delete [] copy;
+      lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run");
+    }
+
     char *ptr = copy;
     for (int i=0; i < n-1; ++i) {
 
-- 
GitLab