diff --git a/pyEpiabm/pyEpiabm/core/person.py b/pyEpiabm/pyEpiabm/core/person.py index f44bdcd4c..870d40ff1 100644 --- a/pyEpiabm/pyEpiabm/core/person.py +++ b/pyEpiabm/pyEpiabm/core/person.py @@ -285,8 +285,8 @@ def increment_secondary_infections(self): infected multiple times, then we only increment the current secondary infection count) """ - if self.secondary_infections_counts: + try: self.secondary_infections_counts[-1] += 1 - else: + except IndexError: raise RuntimeError("Cannot call increment_secondary_infections " "while secondary_infections_counts is empty")