Skip to content

Commit 3363765

Browse files
rhttpike3
authored andcommitted
wolf_sheep: Handle the case when type_class not in agents_by_type
1 parent 07abfdf commit 3363765

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/wolf_sheep/wolf_sheep/scheduler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def get_type_count(
2222
Returns the current number of agents of certain type in the queue
2323
that satisfy the filter function.
2424
"""
25+
if type_class not in self.agents_by_type:
26+
return 0
2527
count = 0
2628
for agent in self.agents_by_type[type_class]:
2729
if filter_func is None or filter_func(agent):

0 commit comments

Comments
 (0)