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 6626322
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rmgpy/data/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,14 @@ 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 while following thermo group data pointers. A circular"
" reference may exist. 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 6626322

Please sign in to comment.