diff --git a/pkg_auto/impl/sort_packages_list.py b/pkg_auto/impl/sort_packages_list.py index 909cd0b6ff4..9486bbff97e 100755 --- a/pkg_auto/impl/sort_packages_list.py +++ b/pkg_auto/impl/sort_packages_list.py @@ -106,7 +106,7 @@ def get_batches(self): pkg_lines += [line] else: if pkg_lines: - while not free_form_lines[-1]: + while free_form_lines and not free_form_lines[-1]: free_form_lines = free_form_lines[:-1] batches += [Reader.CommentBatch(free_form_lines, pkg_lines)] free_form_lines = []