From 0eebc50688b960f657dba0846c7441931cdeda27 Mon Sep 17 00:00:00 2001 From: Tobias Langer Date: Wed, 23 Nov 2016 19:26:39 +0100 Subject: [PATCH] Fixed error. --- tasksetgen.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 -- libgit2 0.26.0