Skip to content

Commit 6626322

Browse files
committed
Add Loop Counter to __addGroupThermoData
Prevents the while loop from repeating indefinitely.
1 parent 64f7535 commit 6626322

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rmgpy/data/thermo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,14 @@ def __addGroupThermoData(self, thermoData, database, molecule, atom):
17401740

17411741
data = node.data
17421742
comment = node.label
1743+
loop_count = 0
17431744
while isinstance(data, basestring):
1745+
loop_count += 1
1746+
if loop_count > 100:
1747+
raise DatabaseError("Maximum iterations reached while following thermo group data pointers. A circular"
1748+
" reference may exist. Last node was {0} pointing to group called {1} in "
1749+
"database {2}".format(node.label, data, database.label))
1750+
17441751
for entry in database.entries.itervalues():
17451752
if entry.label == data:
17461753
data = entry.data

0 commit comments

Comments
 (0)