From 6c376a68093258dd222912a64b39e3479bdee342 Mon Sep 17 00:00:00 2001 From: Jez Swann Date: Wed, 14 Feb 2024 14:54:48 +0000 Subject: [PATCH] Safety checking lenth of lib before indexing. --- jade/computational.py | 2 +- jade/libmanager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jade/computational.py b/jade/computational.py index 5e254bbd..85d7e801 100644 --- a/jade/computational.py +++ b/jade/computational.py @@ -111,7 +111,7 @@ def executeBenchmarksRoutines(session, lib: str, runoption, exp=False) -> None: # Handle dic string as lib pat_libs = re.compile(r'"\d\d[a-zA-Z]"') - if lib[0] == "{": + if len(lib)>0 and lib[0] == "{": libs = pat_libs.findall(lib) libpath = libs[1][1:-1] elif "-" in lib: diff --git a/jade/libmanager.py b/jade/libmanager.py index f7d01e53..3620f14e 100644 --- a/jade/libmanager.py +++ b/jade/libmanager.py @@ -495,7 +495,7 @@ def select_lib(self, code: str = "mcnp") -> str: if lib in self.libraries[code]: break - elif lib[0] == "{": + elif len(lib)>0 and lib[0] == "{": libs = json.loads(lib) # all libraries should be available tocheck = list(libs.values())