Skip to content

Commit

Permalink
Add Loop Counter to __addGroupThermoData
Browse files Browse the repository at this point in the history
Prevents the while loop from repeating indefinitely.
  • Loading branch information
amarkpayne committed Aug 28, 2017
1 parent 64f7535 commit a01b5ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rmgpy/data/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,15 @@ def __addGroupThermoData(self, thermoData, database, molecule, atom):

data = node.data
comment = node.label
loop_count = 0
while isinstance(data, basestring):
loop_count += 1
if loop_count > 100:
raise DatabaseError("Maximum iterations reached for __addGroupThermoData (100). Last node was {0} "
"pointing to group called {1} in database {2}".format(node.label,
data,
database.label))

for entry in database.entries.itervalues():
if entry.label == data:
data = entry.data
Expand Down

0 comments on commit a01b5ff

Please sign in to comment.