Skip to content

Commit a01b5ff

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

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rmgpy/data/thermo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,15 @@ 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 for __addGroupThermoData (100). Last node was {0} "
1748+
"pointing to group called {1} in database {2}".format(node.label,
1749+
data,
1750+
database.label))
1751+
17441752
for entry in database.entries.itervalues():
17451753
if entry.label == data:
17461754
data = entry.data

0 commit comments

Comments
 (0)