diff --git a/tasksetgen.py b/tasksetgen.py index c639d66..1c719b2 100755 --- a/tasksetgen.py +++ b/tasksetgen.py @@ -55,11 +55,14 @@ def lcm(a, b): return (a * b) / gcd(a, b) def hyperperiod(tasks): - periods = [task.period for task in tasks] - hyperperiod = periods[0] - for period in periods[1:]: - hyperperiod = lcm(hyperperiod, period) - return hyperperiod + try: + periods = [task.period for task in tasks] + hyperperiod = periods[0] + for period in periods[1:]: + hyperperiod = lcm(hyperperiod, period) + return hyperperiod + except IndexError: + return 0 class Timebase(Enum): seconds = 1