Skip to content

Commit

Permalink
Merge pull request #230 from javierbg/master
Browse files Browse the repository at this point in the history
Added support for empty population in HallOfFame.update
  • Loading branch information
fmder committed Nov 13, 2017
2 parents 07419de + a6c4607 commit 2d5ab68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deap/tools/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def update(self, population):
:param population: A list of individual with a fitness attribute to
update the hall of fame with.
"""
if len(self) == 0 and self.maxsize !=0:
if len(self) == 0 and self.maxsize !=0 and len(population) > 0:
# Working on an empty hall of fame is problematic for the
# "for else"
self.insert(population[0])
Expand Down

0 comments on commit 2d5ab68

Please sign in to comment.