diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 913f88c0e2..eaddd0a9b0 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -298,7 +298,10 @@ def make_template_expander(filename): def enum_last_value(iterable, start=0): it = iter(iterable) count = start - last = next(it) + try: + last = next(it) + except StopIteration: + return for val in it: yield count, False, last last = val