Skip to content

Commit 9aade8e

Browse files
committed
Test for None-ness before attempting any function call
1 parent 64e7429 commit 9aade8e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pynch/nubase_parse.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def _read_decay_string(self, line: str) -> str:
6666
else self._read_substring(line, self.START_DECAYSTRING, len(line))
6767
)
6868

69+
if decay_string is None:
70+
decay_string = "UNKNOWN"
6971
# Get the first value in the ';' separated list
7072
# Get the initial part of the first value
7173
filtered = re.split('=| |~|<|>', decay_string.split(';')[0])[0]
@@ -81,7 +83,8 @@ def _read_decay_string(self, line: str) -> str:
8183
def _read_line(self, line: str) -> dict:
8284
"""Read a line of the file."""
8385
# Ignore isomers for the moment
84-
if self._read_as_int(line, self.START_STATE, self.END_STATE) > 0:
86+
state = self._read_as_int(line, self.START_STATE, self.END_STATE)
87+
if state is None or state > 0:
8588
return dict()
8689

8790
exp = True if line.find("#") == -1 else False

0 commit comments

Comments
 (0)